我如何检测回收器 View 何时位于列表底部,而不仅仅是屏幕底部,而是 RecyclerView 中的最后一项。现在我正在使用 SwipeRefreshLayout,但我无法将其设置为 Pull Up。
最佳答案
在 onScrolled()
回调中使用此代码。
int lastVisibleItem = ((LinearLayoutManager) layoutManager).findLastVisibleItemPosition();
int totalItemCount = layoutManager.getItemCount();
if (lastVisibleItem >= totalItemCount - 10) {
loadMore();
}
关于java - RecyclerView 上拉刷新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25985528/