RecyclerView pulls up to update
How can I detect when the recycler view is at the bottom of the list and not at the bottom of the screen only, but the last item in the RecyclerView. Right now I am using SwipeRefreshLayout, but I am unable to customize the Pull Up.
+3
Brady131313
source
to share
2 answers
Use this code inside a callback onScrolled()
.
int lastVisibleItem = ((LinearLayoutManager) layoutManager).findLastVisibleItemPosition();
int totalItemCount = layoutManager.getItemCount();
if (lastVisibleItem >= totalItemCount - 10) {
loadMore();
}
+4
localhost
source
to share
add a scroll listener.
RecyclerView.addOnScrollListener(OnScrollListener listener)
-1
Andy
source
to share