三星s6点击检测问题

时间:2015-05-04 09:10:26

标签: android

我在使用三星S6的GestureDetector时遇到了一些问题。 MotionEvent流程如下:

MotionEvent { action=ACTION_DOWN, id[0]=0, x[0]=5230.164, y[0]=995.625, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=9448672, downTime=9448672, deviceId=4, source=0x1002 }
MotionEvent { action=ACTION_MOVE, id[0]=0, x[0]=5230.164, y[0]=994.6875, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=1, eventTime=9448687, downTime=9448672, deviceId=4, source=0x1002 }
MotionEvent { action=ACTION_MOVE, id[0]=0, x[0]=5223.505, y[0]=1001.4341, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=2, eventTime=9448731, downTime=9448672, deviceId=4, source=0x1002 }
MotionEvent { action=ACTION_MOVE, id[0]=0, x[0]=5217.2773, y[0]=1009.2318, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=1, eventTime=9448748, downTime=9448672, deviceId=4, source=0x1002 }
MotionEvent { action=ACTION_MOVE, id[0]=0, x[0]=5214.025, y[0]=1014.31665, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=2, eventTime=9448764, downTime=9448672, deviceId=4, source=0x1002 }
MotionEvent { action=ACTION_UP, id[0]=0, x[0]=5214.025, y[0]=1014.31665, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=9448785, downTime=9448672, deviceId=4, source=0x1002 }

如果我按下我的手指,它通常不会被点击,我必须准确地用我的指尖来获得点击。

似乎在这个特定设备上很容易触发移动事件。有人知道解决方法或一些影响点击检测的调整吗?

感谢。

1 个答案:

答案 0 :(得分:0)

对于我的情况,我最终修改了GestureDetector私有字段mTouchSlopSquare以获得更高的价值。

 try {
        Field field = GestureDetector.class.getDeclaredField("mTouchSlopSquare");
        field.setAccessible(true);
        field.set(mGestureDetector, myValue);
    } catch (Exception e) {
        e.printStackTrace();
    }