private int index = 0;
// 滑动加载
scrollView.setOnTouchListener(
new
OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
switch
(event.getAction()) {
case
MotionEvent.ACTION_DOWN :
break
;
case
MotionEvent.ACTION_MOVE :
index++;
break
;
default
:
break
;
}
if
(event.getAction() == MotionEvent.ACTION_UP && index > 0) {
index = 0;
View view = ((ScrollView) v).getChildAt(0);
if
(view.getMeasuredHeight() <= v.getScrollY() + v.getHeight()) {
//加载数据代码
}
}
return
false
;
}
});
|
index参数防止滑动被多次多次触发