考虑以下示例的视图:
<LinearLayout>
<EditText />
<Button />
</LinearLayout>
在清单文件中:
android:windowSoftInputMode="adjustPan"
onfocus edittext,软键盘覆盖了一个按钮,如下所示:
但我想要这样:
如何滚动视图以使按钮可见?
考虑以下示例的视图:
<LinearLayout>
<EditText />
<Button />
</LinearLayout>
在清单文件中:
android:windowSoftInputMode="adjustPan"
onfocus edittext,软键盘覆盖了一个按钮,如下所示:
但我想要这样:
如何滚动视图以使按钮可见?
我刚找到这个帖子,发现它没有回复。为了帮助可能来的其他人,在清单中使用它进行活动
android:windowSoftInputMode="stateUnchanged|adjustResize"
尝试一个,看看是否适合您的需求。
祝你好运
您可以在按钮下方添加一个空的 RelativeLayout。设置其 android:layout_height="50dp" 或任何满足您需要的值。并使用 ScrollView,注意 ScrollView 只能有 1 个子布局。
<ScrollView >
<LinearLayout>
<EditText />
<Button />
<RelativeLayout
android:layout_height="50dp"
android:layout_width="match_parent" />
</LinearLayout>
</ScrollView>