Frage

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

War es hilfreich?

Lösung

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top