8

Which RecyclerView function returns max Scroll offset?

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

Alpha
  • 1,754
  • 3
  • 21
  • 39

1 Answers1

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;
}
Alexander Skvortsov
  • 2,696
  • 2
  • 17
  • 31
  • Hey @Alexander can you please help me with this https://stackoverflow.com/questions/49952965/recyclerview-horizontal-scrolling-to-left?noredirect=1#comment87861669_49952965 –  May 19 '18 at 10:50