8

Which RecyclerView function returns max Scroll offset?

I need to determine, can i hide footer of Activity or not, by RecyclerView scroll.

1 Answer 1

23

The asked function is recyclerView.computeVerticalScrollRange();

This function returns true if end of scrolling reached.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.