解决多指操作放大缩小 指针错误 java.lang.IllegalArgumentException: pointerIndex out of range

时间:2021-09-01 16:15:56
/** Custom your own ViewPager to extends support ViewPager. java source: */
/** Created by azi on 2013-6-21. */ package com.chaokuadi.android.support.view; import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent; public class ViewPagerFixed extends android.support.v4.view.ViewPager { public ViewPagerFixed(Context context) {
super(context);
} public ViewPagerFixed(Context context, AttributeSet attrs) {
super(context, attrs);
} @Override
public boolean onTouchEvent(MotionEvent ev) {
try {
return super.onTouchEvent(ev);
} catch (IllegalArgumentException ex) {
ex.printStackTrace();
}
return false;
} @Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
try {
return super.onInterceptTouchEvent(ev);
} catch (IllegalArgumentException ex) {
ex.printStackTrace();
}
return false;
}
}

IllegalArgumentException (pointerIndex out of range) while using many fingers to zoom in and out