我有一个 ScrollView布局: ?xml version="1.0" encoding="utf-8"?ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/my_scrollview" android:layout_width="fill_parent" android:layout_height="wrap_conten
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/my_scrollview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<EditText
android:id="@+id/input_one"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:inputType="number" >
<EditText
android:id="@+id/input_two"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:inputType="number" >
<EditText
android:id="@+id/input_three"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:inputType="number" >
<Button
android:id="@+id/ok_btn"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:text="@string/ok_str" />
</LinearLayout>
</ScrollView>
如上所示,简单布局包含三个输入字段和一个“确定”按钮.
我使用上面的布局运行我的应用程序,当我点击第一个输入字段(@ id / input_one)时,软键盘将从屏幕底部弹出,它隐藏第三个输入字段和“确定”按钮.
因为我使用< ScrollView> ,我以为我可以向上滚动页面以查看第三个输入字段和软键盘隐藏的“确定”按钮,但页面不可滚动.为什么?如何摆脱它?基本上,我想看到每个输入字段和“确定”按钮,甚至软键盘弹出.
我通过在< activity>中定义以下属性来解决问题. AndroidManifest.xmlandroid:windowSoftInputMode="stateVisible|adjustResize"
