Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Keyboard is flickering when the EditText input type is number

I have a layout for list items. Inside that layout list item, I have an Edit Text with input type as number.

My issue is when i click on the edit text the keyboard is flickering with normal alpha numerical key board and number key.

I am not getting any idea why it is happens.

Layout.xml

  <EditText
                android:id="@+id/edit_quantity"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/total"
                android:layout_centerHorizontal="true"
                android:background="@color/bg_white"
                android:gravity="center"
                android:inputType="number"
                android:maxLength="4"
                android:maxLines="1"
                android:minWidth="@dimen/view_cart_count_min_width"
                android:paddingLeft="@dimen/padding_normal"
                android:paddingRight="@dimen/padding_normal"
                android:textSize="@dimen/text_medium" />

Manifest.xml

    <activity
        android:name="com.manoramaonline.entedeal.MyCartActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize|stateVisible" >
    </activity>

when I change the softInputMode to adJustPan the keyboard flickirinf is stop, but the screen not resizing. So the keyboard is comes over the layout.

When android:windowSoftInputMode is adjust resize with edit text input type number that time the keyboard is flickering

I there any solution that reduce the screen size when the soft keyboard is open.

like image 484
Binil Surendran Avatar asked Aug 19 '16 05:08

Binil Surendran


1 Answers

I had a similar issue. I had an Edit Text inside of an list adapter. In the xml for the ExitText, I had android:inputType="numberDecimal".

In the manifest file, I had the following line for the activity: android:windowSoftInputMode="stateHidden|adjustNothing" When I would select an edit box, it only displayed the numeric keypad (and stopped all of that thrashing).

I picked this up from question 28674967.

like image 102
J. R. Schweitzer Avatar answered Oct 21 '22 09:10

J. R. Schweitzer