问题
I have an andriod 2.3.5 phone,it can connect to a bluetooth mouse. But I find it only response to left-click and mouse-move.
if (event.getAction() == MotionEvent.ACTION_DOWN) {//Left Button
} else if (event.getAction() == MotionEvent.ACTION_UP) {//Left Button
} else if (event.getAction() == MotionEvent.ACTION_MOVE) {
}
What are the other action codes,such as Right Button,Wheel?
thanks
回答1:
Apparently API level you're using (10) still doesn't have any way of discerning between one mouse button or the other and all clicks are treated as touches on the screen. If you were working with 14+ you could do MotionEvent.getButtonState()
to check wether it's the primary, secondary or other button that got pressed.
Source
来源:https://stackoverflow.com/questions/13100451/can-android-os-capture-bluetooth-mouse-right-click-and-wheel-event