简体   繁体   中英

Android: The numeric floating keyboard blocks EditText on 10 inch tablet

I am aware to prevent blocking. we have to use android:windowSoftInputMode="adjustResize" in AndroidManifest.xml. It works very nice until the main Keyboard switches to numeric floating keyboard and the numeric keyboard covers EditText(in 10 inch Tablet). As you see in the following picture: 在此处输入图片说明 We can move it by finger but I want to move it automatically(programmatically). Could you please help me?

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_kopf_daten_erfassen"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
>


        <LinearLayout
            android:id="@+id/LL1"
            android:layout_marginTop="30dp"
            android:layout_alignParentTop="true"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:layout_centerVertical="true">

            <TextView
                android:id="@+id/TV_HL_id"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:textColor="@color/black"
                android:text="@string/text_holzliste" />

            <Spinner
                android:id="@+id/kubaturErfahrung_HE_id"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="30dp"
                />

        </LinearLayout>

<ScrollView
    android:id="@+id/scrollImg"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/LL1"
    android:layout_above="@+id/Bt_holzliste_eintrag"
    >
<LinearLayout

    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:layout_centerVertical="true">
    <EditText
        android:id="@+id/polterNr_HL_id"
        android:inputType="number"
        android:visibility="gone"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="60dp"
        android:layout_marginRight="60dp"
        android:hint="@string/polter_nummer" />
    <EditText
        android:id="@+id/kaufer_HE_id"
        android:inputType="number"
        android:visibility="gone"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="60dp"
        android:layout_marginRight="60dp"
        android:hint="@string/kaufer"/>

    <EditText
        android:id="@+id/holzNr_HL_id"
        android:inputType="number"
        android:visibility="gone"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="60dp"
        android:layout_marginRight="60dp"
        android:hint="@string/HolzNr" />
    <EditText
        android:id="@+id/teilstuck_HE_id"
        android:inputType="number"
        android:visibility="gone"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="60dp"
        android:layout_marginRight="60dp"
        android:ellipsize="start"
        android:hint="@string/teilstuck"/>

    <EditText
        android:id="@+id/lange_HE_id"
        android:inputType="numberDecimal"
        android:visibility="gone"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="60dp"
        android:layout_marginRight="60dp"
        android:ellipsize="start"
        android:hint="@string/lange"/>
    <AutoCompleteTextView
        android:id="@+id/baumart_HE_id"
        android:visibility="gone"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="60dp"
        android:layout_marginRight="60dp"
        android:ellipsize="start"
        android:completionThreshold="1"
        android:hint="@string/baumart"/>
    <AutoCompleteTextView
        android:id="@+id/sorte_HE_id"
        android:visibility="gone"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="60dp"
        android:layout_marginRight="60dp"
        android:completionThreshold="1"
        android:hint="@string/sorte"/>
    <AutoCompleteTextView
        android:id="@+id/gute_HE_id"
        android:visibility="gone"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="60dp"
        android:layout_marginRight="60dp"
        android:completionThreshold="1"
        android:hint="@string/gute"/>
    <EditText
        android:id="@+id/durchmesser_HE_id"
        android:inputType="number"
        android:visibility="gone"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="60dp"
        android:layout_marginRight="60dp"
        android:hint="@string/durchmesser"/>
    <EditText
        android:id="@+id/stuck_HE_id"
        android:inputType="number"
        android:visibility="gone"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="60dp"
        android:layout_marginRight="60dp"
        android:ellipsize="start"
        android:hint="@string/stuck"/>
    <EditText
        android:id="@+id/menge_HE_id"
        android:inputType="number"
        android:visibility="gone"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="60dp"
        android:layout_marginRight="60dp"
        android:ellipsize="start"
        android:hint="@string/menge"/>
</LinearLayout>

</ScrollView>


<Button
    android:id="@+id/Bt_holzliste_eintrag"
    android:onClick="saveEintrag"
    android:layout_width="fill_parent"
    android:background="@color/gray"
    android:textColor="@color/lightGray"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:text="@string/kopf_daten_erfassen" />

Change default behaviour of directional navigation by using following XML attributes:

  <android:nextFocusForward="@+id/.." >
    <requestFocus />

like this

 <EditText
        android:id="@+id/editText1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="32dp"
        android:layout_marginTop="16dp"
        android:imeOptions="actionNext"
        android:singleLine="true"
        android:ems="10" >

        <requestFocus />
    </EditText>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM