Edit weird behavior text

I have an ExpandableListView that contains a custom layout RecyclerView. This layout contains some views, including my EditText.

My behavior: when I click on my EditText number , the keyboard appears for about 0.5 s, the entire layout is cleared with default values, then the keyboard disappears, the text EditText appears, and finally I lose focus. When I click on it again, the keyboard remains, but in text type . The strange thing: the problem seems to be only on devices where the entire layout overflows the screen, because on a 10-inch tablet everything is fine (the layout does not clear, but the keyboard does not disappear).

In my opinion, when I get focus in EditText, the layout is recreated, making it cleaned up.

For a long time I tried to find out what was happening, but I did not find anything. Here is what I tried but didn't change anything:

android:descendantFocusability="beforeDescendants" // on all parent of the EditText

focusable="true" // On the EditText

android:windowSoftInputMode="adjustPan" // In the activity in the manifest

making all the ViewHolder attributes final

Since the code is very large for all of this, I don’t know what I should post to help. So feel free to ask something if it can help.

Thank!

EDIT: Gif showing the problem https://imgur.com/a/BPue4

+4
source share
1 answer

Try adding this line to your activity on manifest.xml:

android:configChanges="keyboardHidden|screenSize"

Opening keyboard or screen changes may result in your content being re-created.

0
source

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


All Articles