我正在使用VerticalViewPager滚动浏览两个片段,但是当我触摸EditText / Buttons时,滚动功能无效... 仅限观点...
public class VerticalViewPager extends ViewPager {
public VerticalViewPager(Context context) {
this(context, null);
}
public VerticalViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
setPageTransformer(true, new DefaultTransformer());
}
private MotionEvent swapTouchEvent(MotionEvent event) {
float width = getWidth();
float height = getHeight();
float swappedX = (event.getY() / height) * width;
float swappedY = (event.getX() / width) * height;
event.setLocation(swappedX, swappedY);
return event;
}
public boolean onInterceptTouchEvent(MotionEvent event) {
swapTouchEvent(event);
return super.onInterceptTouchEvent(swapTouchEvent(event));
}
public boolean onTouchEvent(MotionEvent ev) {
return super.onTouchEvent(swapTouchEvent(ev));
}
}
我该怎么办? 感谢