smoothScrollToPosition after notifyDataSetChanged not working in android

前端 未结 2 482
轻奢々
轻奢々 2020-12-05 05:05

I\'ve got a custom Adapter for a ListView setup and working ok. On a button click something is changed in the underlying data, so a notifyDataSetChanged is required to refre

2条回答
  •  一生所求
    2020-12-05 05:20

    Use the post() method to wait for the list to finish updating after you call notifyDataSetChanged():

    adapter.notifyDataSetChanged();
    list.post( new Runnable() {
        @Override
        public void run() {
        //call smooth scroll
        }
      });
    

提交回复
热议问题