简体   繁体   中英

RecyclerView with EditText

I have a RecyclerView whose elements contain EditText with focusable = false . On a special event, I make one of them focused (focusable = true, focusableInTouchMode = true, requestFocus) , and then I show the onscreen keyboard. In this case, the application area becomes significantly smaller in height due to the keyboard and some of the RecyclerView items are no longer visible and therefore destroyed. The problem is that if the edited element is close to the bottom of the screen, then it is destroyed and the user can not edit it. A simple scrollToPosition does not help, because without the on-screen keyboard, the element is already visible on the screen and no scrolling occurs.

How can I avoid the disappearance of the item being edited?

Will you try this:

<activity
    ......
    android:windowSoftInputMode="adjustResize"
    ...... >
</activity>

In your manifest under activity(which has recycler view) tag, add above property.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM