安卓:滚动型不带键盘的滚动出 [英] Android: ScrollView not scrolling with keyboard out
问题描述
我有一些意见,从其中一个是一个EditText的布局。布局能够装在一个页面上,但是,当软键盘出来,布局不会滚动。 这是我的布局表现:
I've got a layout with some views, from which one is an EditText. The layout easily fits on one page, BUT, when the soft keyboard is out, the layout doesn't scroll. Here's a recap of my layout:
<?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="@drawable/background" >
<ScrollView
android:id="@+id/ScrollView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<CheckBox/>
<TextView/>
<LinearLayout>
<EditText>
<requestFocus />
</EditText>
</LinearLayout>
<TextView/>
<LinearLayout>
<Spinner/>
</LinearLayout>
</LinearLayout>
</ScrollView>
<Button
android:layout_alignParentBottom="true" />
</RelativeLayout>
和我的表现我已经宣布该属性:
And in my manifest I have declared the attribute:
android:windowSoftInputMode="adjustResize|stateHidden"
有谁知道为什么它不工作,如何确保它的工作?
Does anyone know why it doesn't work and how to make sure it does work?
在此先感谢!
推荐答案
好了,显然是滚动型的安卓layout_height
一定不能设置为 WRAP_CONTENT
。我将它设置为 match_parent
,并设置机器人:layout_above
来在页面底部的按钮
Okay, apparently the ScrollView's android:layout_height
mustn't be set to wrap_content
. I set it to match_parent
and set the android:layout_above
to the button on the bottom of the page.
不要问我为什么,但这个固定的问题。
Don't ask me why, but this fixed the issue.
这篇关于安卓:滚动型不带键盘的滚动出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!