Android键盘隐藏编辑文本字段

时间:2016-02-03 14:41:57

标签: android android-layout android-keypad android-screen

如何限制键盘隐藏的编辑文本以用于以下XML布局。在这个蓝色区域是屏幕的页眉和页脚,在页眉和页脚之间我在滚动视图下放置了编辑文本以获取用户信息,加热器和不应滚动页脚,以便将编辑文本字段放在滚动视图下。

根据以下异常,编辑文本由键盘覆盖。我怎样才能克服这个问题呢?

我在清单中添加了调整平移和调整大小选项。

<activity
    android:name=".TestActivity6"
    android:screenOrientation="portrait"
    android:windowSoftInputMode="adjustPan|adjustResize" />

XML屏幕:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <RelativeLayout
        android:id="@+id/test_reg_top"
        android:layout_width="fill_parent"
        android:layout_height="130dp"
        android:layout_alignParentTop="true"
        android:background="#0000A1" />

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_above="@+id/test_reg_bottom"
        android:layout_below="@+id/test_reg_top"
        android:background="#BBBCCC">

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <EditText
                android:id="@+id/test_reg_et1"
                android:layout_width="fill_parent"
                android:layout_height="50dp"
                android:layout_marginTop="5dp"
                android:background="#E6E6E6"
                android:hint="text1"
                android:nextFocusDown="@+id/test_reg_et2"
                android:singleLine="true" />

            <EditText
                android:id="@+id/test_reg_et2"
                android:layout_width="fill_parent"
                android:layout_height="50dp"
                android:layout_marginTop="5dp"
                android:background="#E6E6E6"
                android:hint="text2"
                android:nextFocusDown="@+id/test_reg_et3"
                android:singleLine="true" />

            <EditText
                android:id="@+id/test_reg_et3"
                android:layout_width="fill_parent"
                android:layout_height="50dp"
                android:layout_marginTop="5dp"
                android:background="#E6E6E6"
                android:hint="text3"
                android:nextFocusDown="@+id/test_reg_et4"
                android:singleLine="true" />

            <EditText
                android:id="@+id/test_reg_et4"
                android:layout_width="fill_parent"
                android:layout_height="50dp"
                android:layout_marginTop="5dp"
                android:background="#E6E6E6"
                android:hint="text4"
                android:nextFocusDown="@+id/test_reg_et5"
                android:singleLine="true" />

            <EditText
                android:id="@+id/test_reg_et5"
                android:layout_width="fill_parent"
                android:layout_height="50dp"
                android:layout_marginTop="5dp"
                android:background="#E6E6E6"
                android:hint="text5"
                android:imeOptions="actionDone"
                android:singleLine="true" />
        </LinearLayout>
    </ScrollView>

    <RelativeLayout
        android:id="@+id/test_reg_bottom"
        android:layout_width="fill_parent"
        android:layout_height="130dp"
        android:layout_alignParentBottom="true"
        android:background="#0000A1" />
</RelativeLayout>

屏幕: enter image description here

0 个答案:

没有答案
相关问题