实现如下:
public class NoScrollViewPager extends ViewPager {
public NoScrollViewPager (Context context) {
super(context);
}
public NoScrollViewPager (Context context, AttributeSet attrs) {
super(context, attrs);
}
/**
* 表示事件是否拦截,返回false表示不拦截,传递给子控件
*/
@Override
public boolean onInterceptTouchEvent(MotionEvent arg0) {
return false;
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
return false;
}
}