Invalid EditText behavior in ListView BaseAdapter

I have a ListView populated with BaseAdapter. There is a numeric EditText in the listview element:

...
            <EditText
                android:id="@+id/edit_quantita"
                android:layout_width="50dp"
                android:layout_height="30dp"
                android:layout_gravity="center"
                android:layout_marginTop="5dp"
                android:background="@drawable/edit_quantita"
                android:gravity="center_vertical|center_horizontal"
                android:inputType="number"
                android:text="1"
                android:textColor="#fff"
                tools:ignore="HardcodedText" >

            </EditText>
...

When I click on this EditText, the numeric keypad asks for a moment, and then suddenly overlays with a regular character keyboard. If I try to write something on this keyboard, the text will not be shown anywhere. Curiously, if I touch Editext again, it will behave as it should, showing only a working numeric keypad.

What can I do?

+4
source share
2 answers

EditText ListView. onCreate():

int apiVersion = android.os.Build.VERSION.SDK_INT;
if (apiVersion >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH)
            getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
else
            getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
+5

:

  • , EditText, .
  • EditText , .
  • , , - . , EditText , , , - .

, .

0

Source: https://habr.com/ru/post/1527875/


All Articles