pointerIndex out of range pointe

2020-04-20  本文已影响0人  落后程序员

viewpager会出现这个问题,使用viewpager最好自定义重写onInterceptTouchEvent进行try下

java.lang.IllegalArgumentException: pointerIndex out of range pointerIndex=-1 pointerCount=1
    at android.view.MotionEvent.nativeGetAxisValue(Native Method)
    at android.view.MotionEvent.getX(MotionEvent.java:2216)
    at android.support.v4.view.ViewPager.onInterceptTouchEvent(ViewPager.java:2066)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2582)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3041)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2728)
 @Override
    public boolean onInterceptTouchEvent(MotionEvent event) {
        try {
            return super.onInterceptTouchEvent(event);
        } catch (IllegalArgumentException  e) {
            e.printStackTrace();
        }
        return false ;
    }
上一篇 下一篇

猜你喜欢

热点阅读