在 Android ListView/RecyclerView 中自动执行 "load more" 的现代方法
Modern way of doing automatic "load more" in Android ListView/RecyclerView
我实施了 但这个问题很老了。当项目加载时,我的列表移到顶部,我必须再次一直滚动到底部。
我认为有一种更好的方法可以在您到达结尾时自动更新列表,所以我想在 2020 年提出。
这里的Android Jetpack Paging library是目前的推荐。
您应该在 Paging 库的文档中使用 RecyclerView
instead of a ListView
, and then you can create an adapter that subclasses PagedListAdapter
. From there, you can created PagedList
instances from your data source, and submit them to your adapter via submitList
. You can find more information and a detailed walkthrough。
我实施了 但这个问题很老了。当项目加载时,我的列表移到顶部,我必须再次一直滚动到底部。
我认为有一种更好的方法可以在您到达结尾时自动更新列表,所以我想在 2020 年提出。
这里的Android Jetpack Paging library是目前的推荐。
您应该在 Paging 库的文档中使用 RecyclerView
instead of a ListView
, and then you can create an adapter that subclasses PagedListAdapter
. From there, you can created PagedList
instances from your data source, and submit them to your adapter via submitList
. You can find more information and a detailed walkthrough。