Android RecyclerView max scroll offset

Which function RecyclerView

returns the maximum scroll offset?

I need to determine if I can hide the footer Activity

or not by scrolling RecyclerView

.

+3


source to share


1 answer


The requested function recyclerView.computeVerticalScrollRange ();

This function returns true if the end of the scroll has been reached.



static private boolean isMaxScrollReached(RecyclerView recyclerView) {
    int maxScroll = recyclerView.computeVerticalScrollRange();
    int currentScroll = recyclerView.computeVerticalScrollOffset() + recyclerView.computeVerticalScrollExtent();
    return currentScroll >= maxScroll;
}

      

+12


source







All Articles