尝试初始化水平滚动视图类时出现此错误:
java.lang.NoClassDefFoundError: Could not initialize class android.view.GestureDetector
private synchronized void initView() {
mLeftViewIndex = -1;
mRightViewIndex = 0;
mDisplayOffset = 0;
mCurrentX = 0;
mNextX = 0;
mMaxX = Integer.MAX_VALUE;
mScroller = new Scroller(getContext());
mGesture = new GestureDetector(getContext(), mOnGesture);
}
错误被追溯到这一行:
mGesture = new GestureDetector(getContext(), mOnGesture);
mGesture 是一个私有的 GestureDetector:
private GestureDetector mGesture;