android-asynclistdiffer

RecyclerView scroll to top with AsyncListDiffer not working

a 夏天 提交于 2020-01-04 01:53:04
问题 I am using RecyclerView with AsyncListDiffer (calculates and animates differences between old and new items, all on background thread). I have a button to sort the list. After I sort it and re-set it to RecyclerView using mDiffer.submitList(items); I also call recyclerView.scrollToPosition(0) or ( smoothScrollToPosition(0) ), but it has no effect. I think this behaviour is expected, as AsyncListDiffer is probably still calculating differences at the time that scrollToPosition(0) is called, so