If inputType is number soft keyboard covers edittext field

时间:2017-08-04 13:10:56

标签: android android-edittext android-keypad android-inputtype

It is working fine for default inputType but for number, screen doesn't get resized. I am using android:windowSoftInputMode="adjustResize" in manifest file for activity. I have 'Mail ID' and 'Mobile No' fields in the bottom of the form.like this

enter image description here

It works fine for Mail ID..

enter image description here

But for Mobile No which is number field..

enter image description here

Here is part of my xml file... mobile no is editTest field with inputType number in last.

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

    <ScrollView
        android:id="@+id/scrollview"
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1"
        android:scrollbars="none">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/white_smoke"
            android:orientation="vertical"
            android:paddingBottom="8dp">

            <LinearLayout
                style="@style/FormItemStyle"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <TextView
                    style="@style/TextFormLabel"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text="Name*" />

                <EditText
                    android:id="@+id/edt_f_name"
                    style="@style/EditTextBgStyle"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="2.5"
                    android:inputType="textCapWords|textNoSuggestions" />
            </LinearLayout>
.
.
.
.
other view 
           .
              .

            <LinearLayout
                style="@style/FormItemStyle"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <CheckBox
                    android:id="@+id/check_adds_same_as_per"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Same as Permanent Address" />

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

                    <TextView
                        style="@style/TextFormLabel"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="Communication Address*" />

                    <EditText
                        android:id="@+id/edt_commun_adds"
                        style="@style/EditTextBgStyle"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="2.5"
                        android:gravity="top"
                        android:lines="3"
                        android:maxLines="4"
                        android:inputType="textMultiLine|textNoSuggestions" />
                </LinearLayout>
            </LinearLayout>

            <LinearLayout
                style="@style/FormItemStyle"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <TextView
                    style="@style/TextFormLabel"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text="Mail ID" />

                <EditText
                    android:id="@+id/edt_mail_id"
                    style="@style/EditTextBgStyle"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="2.5" />
            </LinearLayout>

            <LinearLayout
                style="@style/FormItemStyle"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <TextView
                    style="@style/TextFormLabel"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text="Mobile No*" />

                <EditText
                    android:id="@+id/edt_mobile_no"
                    style="@style/EditTextBgStyle"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="2.5"
                    android:inputType="number"
                    android:maxLength="10" />
            </LinearLayout>

        </LinearLayout>
    </ScrollView>

    <include layout="@layout/master_button" />
</LinearLayout>

1 个答案:

答案 0 :(得分:0)

Instead of android:windowSoftInputMode="adjustResize" try to use android:windowSoftInputMode="adjustPan" in Manifest.xml

相关问题