美文网首页
pointerIndex out of range pointe

pointerIndex out of range pointe

作者: 落后程序员 | 来源:发表于2020-04-20 17:27 被阅读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 ;
    }

相关文章

网友评论

      本文标题:pointerIndex out of range pointe

      本文链接:https://www.haomeiwen.com/subject/xexjihtx.html