6

I am using a NestedScrollView and I want to check if the NestedScrollView is at the bottom or at the top :-)

Any suggestions? Thank you!

FabASP
  • 581
  • 1
  • 6
  • 20

3 Answers3

1
ViewCompat.canScrollVertically(target, -1);
Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
0

Perhaps check if computeVerticalScrollOffset() is in [0,computeVerticalScrollRange()/2]

nullpotent
  • 9,162
  • 1
  • 31
  • 42
0

Create a SetOnScrollChangeListener

BottomSheet.SetOnScrollChangeListener(this);

The inside of the listener interface

  public void OnScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY)
    {
        if (scrollY == 0)
        {
            //Do something here when ur scroll reached the bottom by scrolling up
        }

        if (scrollY == (v.getChildAt(0).getMeasuredHeight() - v.getMeasuredHeight()))
        {
            //Do something here when ur scroll reached top by scrolling down
        }
    }