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


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


source


add a scroll listener.



RecyclerView.addOnScrollListener(OnScrollListener listener)

-1


source







All Articles