我怎么能检测多少滚动视图滚动了?
Answer 1:
你需要重写onScrollChanged()
的滚动型的方法:
@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);
}
在这里, diff
是留给底边之间滚动的空间ScrollView
,并在底部当前可见的内容。 当diff = 0
,则ScrollView
已经完全向下滚动。
文章来源: How to detect how much the view has scroll ScrollView