Inserting RecyclerView items at zero position - always stay scrolled to top

前端 未结 5 658
不知归路
不知归路 2021-01-01 12:32

I have a pretty standard RecyclerView with a vertical LinearLayoutManager. I keep inserting new items at the top and I\'m calling notifyItemI

5条回答
  •  不思量自难忘°
    2021-01-01 13:06

    Use adapter.notifyDataSetChanged() instead of adater.notifyItemInserted(0). This will scroll recylerView to zero position if current scroll position is one(old zero).

提交回复
热议问题