1
我在我的RelativeLayout中有几个EditTexts,并且在它的底部有一个按钮对齐。当弹出键盘时,我希望我的布局调整大小(因此,我使用的是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个屏幕截图来说明发生了什么。请注意,键盘启动后我无法滚动。 谢谢!
你不使用滚动型?我认为我应该用它来处理小屏幕 – 2014-12-04 16:44:55
我想我的问题与设置'android:layout_alignParentBottom =“true”'在视图内的某个滚动视图 – 2014-12-04 16:46:32
无法将线性布局视为rootelement。试一试。 – 2014-12-04 16:50:51