Try this:
@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);
}
To implement this, extend ScrollView
and then override the onScrollChanged
method (inherited from View
).
Reference: Android: Understanding when ScrollView has reached the bottom
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…