我有以下xml
<RelativeLayout
...>
<Toolbar
.../>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/toolbar"
android:fitsSystemWindows="true"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</TextInputLayout>
<TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</TextInputLayout>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</ScrollView>
</RelativeLayout>
在我的AndroidManifest.xml中,我将其设置windowSoftInputMode
为adjustResize
. 但是现在,当我单击其中一个EditText
字段时,布局会向上移动,而我要输入的实际字段甚至不再可见。滚动有效,但仅向下而不是完全向上。有想法该怎么解决这个吗?我不想使用adjustPan
,因为这通常会禁用滚动。