可以Android操作系统捕获蓝牙鼠标右键单击,滚轮事件?蓝牙、鼠标右键、单击、滚轮

2023-09-04 13:11:24 作者:轉身落淚

我有一个的Andr​​iod 2.3.5的手机,它可以连接到蓝牙鼠标。 但我觉得它只是回应左键单击和鼠标移动。

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) {

}

什么是其他行动codeS,比如右键,滚轮?

What are the other action codes,such as Right Button,Wheel?

感谢

推荐答案

您使用的是(10)显然API水平还没有任何挑剔的一个鼠标按钮或其他所有的点击都被视为触摸的方式屏幕上。如果你有14+的工作,你可以做 MotionEvent.getButtonState()来请检查是否这是小学,中学或其他按钮了pressed。

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.

来源

 
精彩推荐
图片推荐