Android ScrollView不响应键盘
我对ScrollView中的EditText滚动行为有一个问题,通常,如果键盘在滚动视图上打开,它会向上滚动滚动滚动视图中的内容。但是,如果您动态地填充scrollview中的布局,键盘会将整个屏幕向上推,那么其他人以前都有过这个问题。 提前谢谢Android ScrollView不响应键盘,android,android-edittext,android-scrollview,Android,Android Edittext,Android Scrollview,我对ScrollView中的EditText滚动行为有一个问题,通常,如果键盘在滚动视图上打开,它会向上滚动滚动滚动视图中的内容。但是,如果您动态地填充scrollview中的布局,键盘会将整个屏幕向上推,那么其他人以前都有过这个问题。 提前谢谢 <ScrollView android:id="@+id/scroll_view" android:layout_width="fill_parent" android:layout_height="wrap_conten
<ScrollView
android:id="@+id/scroll_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/header_area" >
<LinearLayout
android:id="@+id/contentHolder"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
</ScrollView>
此示例在滚动视图中正常工作,线性布局滚动,但即使键盘关闭也显示滚动。我不能使用固定高度
<ScrollView
android:id="@+id/scroll_view"
android:layout_width="fill_parent"
android:layout_height="100dip"
android:layout_below="@+id/header_area" >
<LinearLayout
android:id="@+id/contentHolder"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
</ScrollView>
我在下面尝试过xml,它在一个新项目上按预期工作,但在我的项目中是推上窗口。我发现其他人也有这个问题,我会尽快分享解决方案
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/header_area"
android:layout_width="match_parent"
android:layout_height="50dip" >
</RelativeLayout>
<ScrollView
android:id="@+id/scroll_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/contentHolder"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</ScrollView>
</LinearLayout>
这是因为您的滚动视图可以调整大小。尝试将scrollview的高度设置为与父视图匹配 还可以尝试在滚动视图中设置android:fillViewport=“true” 此外,您不会碰巧在清单的活动标签中添加了以下内容:
android:windowSoftInputMode=“adjustResize”
,这几乎会毁了我们所有的努力。如果清单中有以下内容,请将其删除
您可能需要配置您的清单。软键盘的可能配置列表。它可能是您想要使用的android:WindowsOfInputMode=“adjustPan”
<application
android:icon="@drawable/is_logo_iphone"
android:label="@string/app_name"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" >
解决了这个问题谢谢你的回答。我尝试了每种组合,但效果不太好。谢谢。@ymutlu添加了另一个可能的解决方案谢谢,尝试了,但没有回应。我可能做错了什么。用一个空项目尝试了这个方法,效果很好。嗯,我添加了另一个可能的错误:)你是否在LinearLayout中添加新视图哪个父视图是ScrollView?是的,在scrolView中使用LinearLayout。将视图推入@+id/ContentHolder您的边线布局中有多个EditText。请显示问题的屏幕截图。无法共享屏幕截图,但添加了新布局。发现问题顺便说一句,这都是关于全屏主题。感谢您的回复。是的,Android现在仍然支持在活动全屏时调整软键盘大小。
android:theme="@android:style/Theme.Black.NoTitleBar"