RecyclerView Behavior - Empty When Keyboard is Open / Closed

I implemented a RecyclerView with SearchView and Filterable ; all classes from v7 . Now this behavior is annoying. Whenever the keyboard rises or closes, the contents of the RecyclerView disappear. The counter is still correct, but the view is empty. I guess this has something to do with resizing Layout . Is this normal behavior or is something wrong? How to deal with it? I can show the code, but I don’t know which part will be relevant, so tell me what can I add here?

+5
source share
1 answer

When entering a question, find this one from similar questions.

Please add the following line to your activity in the manifest. Hope this works. android: windowSoftInputMode = "adjustPan"

More precisely, add android:windowSoftInputMode="adjustPan" to the activity tag in AndroidMenifest.xml , where the keyboard will open.

Example:

 <activity android:name=".FManagerActivity" android:label="@string/app_name" android:windowSoftInputMode="adjustPan" android:theme="@style/AppTheme.Light.NoActionBar"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> 

This is basically a behavior in which activity reacts when the keyboard is open or closed. adjustPan tells the keyboard to overlay an activity that does not violate its contents. Without this, when you open the keyboard, the size of the activity changes, which leads to the disappearance of the content, since notifyDatasetChanged() not called during and after implicit actions.

+7
source

All Articles