2

フォームアクティビティをロードするタブホストレイアウトがあります(スクロールバーに10入力)。一番下の入力で入力を開始すると、キーボードが表示され、フォーカスされた入力が表示されず (通常のようにスクロールするのではなく、キーボードが入力に重なって表示されます)、何を入力しているのかわかりません。タブホストの外でフォームアクティビティを実行しようとすると、すべてが正常に機能し、常にフォーカスされた入力を入力して表示できます。私の最小 API レベルは 10、最大は 17 です。

どんな助けや方向性も高く評価されています。

タブホストのレイアウト:

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

   <RelativeLayout
       android:id="@+id/layTab"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:layout_alignParentBottom="true"
       android:layout_centerVertical="true"
       android:gravity="center"
       android:background="#00A99D"
       android:paddingLeft="0dip"
       android:paddingRight="0dip" >

        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:gravity="center|bottom"                
            android:padding="0dip" />

    </RelativeLayout>
    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentTop="true"
        android:layout_above="@id/layTab"/>
</RelativeLayout>

フォームのレイアウト:

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

 <ScrollView 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#eee"
    android:padding="0dip"
    android:layout_alignParentBottom="true">   
<LinearLayout
    android:id="@+id/body"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_below="@id/header"
    android:orientation="vertical" >

<EditText
            android:id="@+id/editText6"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
             android:hint="1"
            android:ems="10" />

         <EditText
            android:id="@+id/editText6"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
             android:hint="2"
            android:ems="10" />             

         <EditText
            android:id="@+id/editText6"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
             android:hint="3"
            android:ems="10" />    

         <EditText
            android:id="@+id/editText6"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
             android:hint="4"
            android:ems="10" />    

         <EditText
            android:id="@+id/editText6"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
             android:hint="5"
            android:ems="10" />    

         <EditText
            android:id="@+id/editText6"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:hint="6"
            android:ems="10" />    

         <EditText
            android:id="@+id/editText6"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:hint="7"
            android:ems="10" />    

         <EditText
            android:id="@+id/editText6"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:hint="8"
            android:ems="10" />    

            <EditText
            android:id="@+id/editText6"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:imeOptions="flagNoExtractUi"
            android:hint="9"
            android:ems="10"/>



               <EditText
            android:id="@+id/editText6"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:hint="10"
            android:ems="10" />    

    </LinearLayout>

</ScrollView>

 </LinearLayout>
4

1 に答える 1

1

When a keyboard pops up, it has 'two visual modes'. FullScreen, meaning that the window in which the keyboard renders is fully overlaying your application or not fullscreen.

In the second case the window, in which your activity displays, is resized. With this resizing, I assume that a TabHost does scale up but the child layouts (in the case your form) are not scaled the same way as if they would be a stand-alone layout.

The Android documentation states that an application using an EditText should be aware of:

  • Properly set the inputType in your editable text views, so that the input method will have enough context to help the user in entering text into them.
  • Deal well with losing screen space when the input method is displayed. Ideally an application should handle its window being resized smaller, but it can rely on the system performing panning of the window if needed. You should set the windowSoftInputMode attribute on your activity or the corresponding values on windows you create to help the system determine whether to pan or resize (it will try to determine this automatically but may get it wrong).
  • You can also control the preferred soft input state (open, closed, etc) for your window using the same windowSoftInputMode attribute.
于 2012-11-26T09:43:53.220 に答える