1

EditTextに入力しようとすると、ソフト キーボードがフィールドを覆い隠してしまいEditTextます。

EditTextソフト キーボードがフィールドを覆い隠すのを防ぐにはどうすればよいですか?

戻るボタンを押した後、入力した内容が表示されます。これは、ソフト キーボードがEditText.

Galaxy 10.1インチタブレットを使用しています。

XML

<ScrollView
            android:layout_width="wrap_content"
            android:layout_height="400dp" >

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

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal" >

                    <TextView
                        android:layout_width="150dp"
                        android:layout_height="wrap_content"
                        android:text="1) Project"
                        android:textColor="#000000"
                        android:layout_gravity="bottom"
                        android:textSize="25sp" />

                    <EditText
                        android:id="@+id/projectET"
                        android:layout_width="500dp"
                        android:layout_height="wrap_content"
                        android:textSize="25sp"
                        android:ems="10"
                        android:hint="Project" 
                        android:inputType="textCapWords"
                        android:layout_gravity="bottom"/>

                    <CheckBox
                        android:id="@+id/projectCBM"
                        android:layout_width="wrap_content"
                        android:layout_height="55dp" />

                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal" >

                    <TextView
                        android:layout_width="150dp"
                        android:layout_height="wrap_content"
                        android:text="2) Customer"
                        android:textColor="#000000"
                        android:layout_gravity="bottom"
                        android:textSize="25sp" />

                    <EditText
                        android:id="@+id/customerET"
                        android:layout_width="500dp"
                        android:layout_height="wrap_content"
                        android:ems="10"
                        android:inputType="textCapWords"
                        android:layout_gravity="bottom"
                        android:textSize="25sp"
                        android:hint="Customer" />

                    <CheckBox
                        android:id="@+id/customerCBM"
                        android:layout_width="wrap_content"
                        android:layout_height="55dp" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal" >

                    <TextView
                        android:id="@+id/material1"
                        android:layout_width="150dp"
                        android:layout_height="wrap_content"
                        android:text="3) Material"
                        android:textColor="#000000"
                        android:layout_gravity="bottom"
                        android:textSize="25sp" />

                    <EditText
                        android:id="@+id/materialET"
                        android:layout_width="500dp"
                        android:layout_height="wrap_content"
                        android:textSize="25sp"
                        android:layout_gravity="bottom"
                        android:inputType="textCapWords"
                        android:ems="10"
                        android:hint="Material" />

                    <CheckBox
                        android:id="@+id/materialCBM"
                        android:layout_width="wrap_content"
                        android:layout_height="55dp" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal" >

                    <TextView
                        android:layout_width="150dp"
                        android:layout_height="wrap_content"
                        android:text="4) Phase"
                        android:layout_gravity="bottom"
                        android:textColor="#000000"
                        android:textSize="25sp" />

                    <EditText
                        android:id="@+id/fazeET"
                        android:layout_width="500dp"
                        android:layout_height="wrap_content"
                        android:ems="10"
                        android:layout_gravity="bottom"
                        android:textSize="25sp"
                        android:enabled="false"
                        android:hint="Phase" />

                    <CheckBox
                        android:id="@+id/fazeCBM"
                        android:layout_width="wrap_content"
                        android:layout_height="55dp"
                        android:enabled="false" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal" >

                    <TextView
                        android:layout_width="150dp"
                        android:layout_height="wrap_content"
                        android:text="5)"
                        android:textColor="#000000"
                        android:layout_gravity="bottom"
                        android:textSize="25sp" />

                    <EditText
                        android:layout_width="500dp"
                        android:layout_height="wrap_content"
                        android:ems="10"
                        android:layout_gravity="bottom"
                        android:textSize="25sp"
                        android:enabled="false"
                        android:hint="" />

                    <CheckBox
                        android:layout_width="wrap_content"
                        android:layout_height="55dp"
                        android:enabled="false" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal" >

                    <TextView
                        android:layout_width="150dp"
                        android:layout_height="wrap_content"
                        android:text="6)"
                        android:layout_gravity="bottom"
                        android:textColor="#000000"
                        android:textSize="25sp" />

                    <EditText
                        android:layout_width="500dp"
                        android:layout_height="wrap_content"
                        android:ems="10"
                        android:layout_gravity="bottom"
                        android:textSize="25sp"
                        android:enabled="false"
                        android:hint="" />

                    <CheckBox
                        android:layout_width="wrap_content"
                        android:layout_height="55dp"
                        android:enabled="false" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal" >

                    <TextView
                        android:layout_width="150dp"
                        android:layout_height="wrap_content"
                        android:text="7)"
                        android:layout_gravity="bottom"
                        android:textColor="#000000"
                        android:textSize="25sp" />

                    <EditText
                        android:layout_width="500dp"
                        android:layout_height="wrap_content"
                        android:ems="10"
                        android:layout_gravity="bottom"
                        android:textSize="25sp"
                        android:enabled="false"
                        android:hint="" />

                    <CheckBox
                        android:layout_width="wrap_content"
                        android:layout_height="55dp"
                        android:enabled="false" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal" >

                    <TextView
                        android:layout_width="150dp"
                        android:layout_height="wrap_content"
                        android:text="8)"
                        android:textColor="#000000"
                        android:layout_gravity="bottom"
                        android:textSize="25sp" />

                    <EditText
                        android:layout_width="500dp"
                        android:layout_height="wrap_content"
                        android:ems="10"
                        android:layout_gravity="bottom"
                        android:textSize="25sp"
                        android:enabled="false"
                        android:hint="" />

                    <CheckBox
                        android:layout_width="55dp"
                        android:layout_height="wrap_content"
                        android:enabled="false" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal" >

                    <TextView
                        android:layout_width="150dp"
                        android:layout_height="wrap_content"
                        android:text="9)"
                        android:textColor="#000000"
                        android:layout_gravity="bottom"
                        android:textSize="25sp" />

                    <EditText
                        android:layout_width="500dp"
                        android:layout_height="wrap_content"
                        android:ems="10"
                        android:layout_gravity="bottom"
                        android:textSize="25sp"
                        android:enabled="false"
                        android:hint="" />

                    <CheckBox
                        android:layout_width="55dp"
                        android:layout_height="wrap_content"
                        android:enabled="false" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal" >

                    <TextView
                        android:layout_width="150dp"
                        android:layout_height="wrap_content"
                        android:text="10)"
                        android:textColor="#000000"
                        android:layout_gravity="bottom"
                        android:textSize="25sp" />

                    <EditText
                        android:layout_width="500dp"
                        android:layout_height="wrap_content"
                        android:ems="10"
                        android:layout_gravity="bottom"
                        android:textSize="25sp"
                        android:enabled="false"
                        android:hint="" />

                    <CheckBox
                        android:layout_width="55dp"
                        android:layout_height="wrap_content"
                        android:enabled="false" />
                </LinearLayout>
            </LinearLayout>
        </ScrollView>
4

2 に答える 2

5

windowSoftInputModeを使用する必要があります。これにより、キーボードが起動したときにUIのサイズを変更できます。ユーザーがEditTextキーボードで入力している間を確認できるようにします。

AndroidManifest.xmlのこの属性をに追加しますActivity

android:windowSoftInputMode="adjustPan"

参照

于 2012-08-09T14:14:26.860 に答える
0

ScrollView通常、ScrollViewは Focused コンポーネントに自動的にスクロールするため、 の上に固定レイアウトがあると思います。

したがって、私が正しければ、2 つのオプションがあります (私は知っています)。

  1. ScrollViewをキーボードの上に持ってくるか、
  2. ScrollViewレイアウトの変更を確認して、上部の表示位置に動的に移動します。表示された後、ユーザーScrollViewに権利が自動的に表示EditTextされます。
于 2012-08-09T14:17:29.170 に答える