EditText loses focus on Scroll in RecyclerView

白昼怎懂夜的黑 提交于 2019-12-05 14:19:35

The whole point of a RecyclerView is to reuse the views so that the phone doesn't have to keep all the rows in memory at once and doesn't have to be constantly destroying and creating views. When your EditText leaves the screen, the phone takes that view, resets its contents and moves it to the bottom of the incoming view stack.

This means that once your EditText leaves the screen it no longer exists. It cannot keep focus because it is removed from the layout.

The only way around this would be what you mentioned, which is storing the position, checking when that position comes onscreen, and manually restoring focus.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!