How can i detect how much a scroll view has scrolled ?
Asked
Active
Viewed 1,100 times
1 Answers
2
You need to override the onScrollChanged()
method of the ScrollView:
@Override
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
Log.i(TAG, "View onScrollChanged");
View view = (View) getChildAt(getChildCount() - 1);
int diff = (view.getBottom() - (getHeight() + getScrollY()));// Calculate
super.onScrollChanged(l, t, oldl, oldt);
}
Here, diff
is the space left for scrolling between the bottom edge of the ScrollView
, and the currently visible content at the bottom. When diff = 0
, the ScrollView
has been scrolled down fully.

Raghav Sood
- 81,899
- 22
- 187
- 195