RecyclerView+Paging3刷新并滚动到顶部

1,439 阅读1分钟
mAdapter.registerAdapterDataObserver(object : RecyclerView.AdapterDataObserver() {
    override fun onItemRangeInserted(positionStart: Int, itemCount: Int) {
        if (positionStart == 0) {
            recyclerView.smoothScrollToPosition(0)
        }
    }
})

原文地址:How do I refresh a RecyclerView + PagedListAdapter and scroll to top?