【发布时间】:2015-02-02 15:07:50
【问题描述】:
我的 RelativeLayout 中有一些 EditText,并在其底部对齐了一个按钮。当键盘弹出时,我希望我的布局调整大小(因此,我使用 android:windowSoftInputMode="adjustResize")并且还希望它可以滚动,因为在较小的屏幕上调整大小是不够的。
问题是我根本无法滚动!
我确实需要按钮留在屏幕底部。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFF">
<!-- some hidden RelativeLayouts, filling the whole screen -->
<RelativeLayout
android:id="@+id/form_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent" android:layout_height="match_parent"
android:fillViewport="true" android:layout_above="@+id/ok_btn">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" android:background="#99000000" android:visibility="visible">
<View
android:id="@+id/shade"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_alignTop="@+id/logradouro1"
android:background="#FFF" android:layout_marginTop="-30dp"/>
<!-- some visible EditTexts and TextViews here -->
</RelativeLayout>
</ScrollView>
<Button android:id="@+id/ok_btn"
android:layout_width="match_parent"
android:layout_height="50dp" android:background="@color/verdeBotao" android:text="Cadastrar"
android:textColor="#FFF" android:layout_alignParentBottom="true"/>
</RelativeLayout>
</RelativeLayout>
下面是 2 个屏幕截图来说明正在发生的事情。请注意,当键盘启动时我无法滚动。 谢谢!
【问题讨论】:
标签: android scrollview android-softkeyboard android-input-method