Android 获取鼠标左、右、滚轮、前键

知识点:GestureDetector + MotionEvent

∵ 根据
MotionEvent.getButtonState()  可以拿到鼠标的左右事件

∴得出
if (ev.getButtonState() == MotionEvent.BUTTON_PRIMARY) 	//获取鼠标左键
if (ev.getButtonState() == MotionEvent.BUTTON_SECONDARY) 	//获取鼠标右键
if (ev.getButtonState() == MotionEvent.BUTTON_TERTIARY) 	//获取鼠标中键
if (ev.getButtonState() == MotionEvent.BUTTON_FORWARD) 	//获取鼠标前键

猜你喜欢

转载自blog.csdn.net/qq_27494201/article/details/125222260