@Override
protected void onScrollChanged(int l, int t, int oldl, int oldt)
{
// Grab the last child placed in the ScrollView, we need it to determinate the bottom position.
View view = (View) getChildAt(getChildCount()-1);
// Calculate the scrolldiff
int diff = (view.getBottom()-(getHeight()+getScrollY()));
// if diff is zero, then the bottom has been reached
if( diff == 0 )
{
// notify that we have reached the bottom
Log.d(ScrollTest.LOG_TAG, "MyScrollView: Bottom has been reached" );
}
super.onScrollChanged(l, t, oldl, oldt);
}
Cheers to this thread for helping me getting the calculations right.
Update:
You can find a full implementation here: InteractiveScrollView.java
Android: Understanding When Scrollview Has Reached The Bottom
This snippet is pretty mutch as the title says, an example in detecting when ScrollView has reached the bottom. In this sample I extend ScrollView and then overrides the onScrollChanged method (inherited from View).