Domanda

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

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top