怎么判断android中ScrollView滑动到了最底部
展开全部
class HomepageOnTouch implements OnTouchListener {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
break;
case MotionEvent.ACTION_MOVE:
View view = ((ScrollView) v).getChildAt(0);
if (view.getMeasuredHeight() <= v.getScrollY() + v.getHeight()) {
Log.i("底部了", "底部了");
}else if(v.getScrollY() == 0){
}
break;
case MotionEvent.ACTION_UP:
break;
}
return false;
}
}
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
break;
case MotionEvent.ACTION_MOVE:
View view = ((ScrollView) v).getChildAt(0);
if (view.getMeasuredHeight() <= v.getScrollY() + v.getHeight()) {
Log.i("底部了", "底部了");
}else if(v.getScrollY() == 0){
}
break;
case MotionEvent.ACTION_UP:
break;
}
return false;
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询