这是我的触摸监听器:
var touchListener = OnTouchListener { view, motionEvent ->
val action = motionEvent.action
when (action and MotionEvent.ACTION_MASK) {
MotionEvent.ACTION_POINTER_DOWN -> {
Toast.makeText(activity, " Two Fingers Tapped Once. Yeeeyy :)", Toast.LENGTH_SHORT).show()
// set the mTwoFingersTapped flag to TRUE when we tap with 2 fingers at once
twoFingers = true
}
}
false
}
在我的点击监听器中,我这样做:
if (!twoFingers) {
todoListener.onCommunicationInfoClicked(addressableReference)
} else {
todoListener.onLongClicked(todoItem)
twoFingers = false
Toast.makeText(activity, " Two Fingers Tapped Once. Yeeeyy :)", Toast.LENGTH_SHORT).show()
}
这适用于 android 手机,如果我用 2 根手指点击并获得所需的效果。但是我用 2 根手指在 chromebook 触摸板上点击,但没有任何反应