How to prevent auto scroll in RecyclerView after notifyDataSetChanged?

前端 未结 3 336
Happy的楠姐
Happy的楠姐 2021-01-14 10:31

I have a RecyclerView with several items types. It looks like this:

  • 07/21/2017
  • Message 1
  • Message 2
  • Message 3
  • 0
3条回答
  •  北海茫月
    2021-01-14 10:52

    Have you played with myRecView.getLayoutManager().setStackFromEnd(boolean) ?

    If you can determine if the new item has been inserted after sorting above or below the visible part and in function of this call setStackFromEnd () with true or false maybe you can avoid the scroll.

    I do not know if it will really work ....

提交回复
热议问题