質問

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

役に立ちましたか?

解決

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top