【发布时间】:2017-04-17 19:14:44
【问题描述】:
当 windowSoftInputMode="adjustPan" 时键盘覆盖按钮时,是否可以滚动到与布局底部对齐的按钮?
我不想使用 windowSoftInputMode="adjustResize" 因为我希望按钮位于键盘下方,并且我想在打开键盘时滚动到按钮。
示例布局:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:id="@+id/scrollView"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:layout_width="match_parent"
android:layout_height="70dp"
android:hint="edit text" />
<EditText
android:layout_width="match_parent"
android:layout_height="70dp"
android:hint="edit text" />
</LinearLayout>
</ScrollView>
<Button
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:text="button" />
</RelativeLayout>
我需要滚动到键盘下方的按钮:
【问题讨论】: