notifyDataSetChanged() makes the list refresh and scroll jumps back to the top

前端 未结 5 1607
自闭症患者
自闭症患者 2020-11-27 05:13

I am trying to implement an endless scroll listview but when I call notifyDataSetChanged() the whole list refreshes then the scroll position goes back to the to

5条回答
  •  南笙
    南笙 (楼主)
    2020-11-27 05:34

    In my case the issue was that I was calling ListView.setAdapter(adapter) every time new data was set which also reset position and the view jumped to the top.

    Removing redundant setAdapter(...) calls fixed it for me.

提交回复
热议问题