看了下网上的资料,你们干嘛搞辣么辣么的复杂
就下面的代码可以搞定
重写下内层viewpager的ontouchevent方法
public boolean onTouchEvent(MotionEvent ev) {
switch (ev.getAction()) {
case MotionEvent.ACTION_DOWN:
getParent().requestDisallowInterceptTouchEvent(true);
break;
case MotionEvent.ACTION_MOVE:
getParent().requestDisallowInterceptTouchEvent(true);
int position = this.getCurrentItem();
if(position==1){
this.setCurrentItem(0);//这个地方的显示有些突然,因为是跳转,不是滑动,可以设置滑动一定的距离再来跳转,或者大家有其他好办法请不吝赐教哦,多谢~
}
break;
case MotionEvent.ACTION_UP:
break;
default:
break;
}