1 private int index = 0; 2 // 滑动加载 3 scrollView.setOnTouchListener(new OnTouchListener() { 4 5 @Override 6 public boolean onTouch(View v, MotionEvent event) { 7 // TODO Auto-generated method stub 8 9 switch (event.getAction()) { 10 case MotionEvent.ACTION_DOWN : 11 12 break; 13 case MotionEvent.ACTION_MOVE : 14 index++; 15 break; 16 default : 17 break; 18 } 19 if (event.getAction() == MotionEvent.ACTION_UP && index > 0) { 20 index = 0; 21 View view = ((ScrollView) v).getChildAt(0); 22 if (view.getMeasuredHeight() <= v.getScrollY() + v.getHeight()) { 23 //加载数据代码 24 } 25 } 26 return false; 27 } 28 });