@Override
public boolean onGenericMotionEvent(MotionEvent event) {
//The input source is a pointing device associated with a display.
//输入源为可显示的指针设备,如:mouse pointing device(鼠标指针),stylus pointing device(尖笔设备)
if (0 != (event.getSource() & InputDevice.SOURCE_CLASS_POINTER)) {
switch (event.getAction()) {
// process the scroll wheel movement...处理滚轮事件
case MotionEvent.ACTION_SCROLL:
//获得垂直坐标上的滚动方向,也就是滚轮向下滚
if (event.getAxisValue(MotionEvent.AXIS_VSCROLL) < 0.0f) {
LogUtils.d("fortest::onGenericMotionEvent down");
}
//获得垂直坐标上的滚动方向,也就是滚轮向上滚
else {
LogUtils.i("fortest::onGenericMotionEvent up");
}
return true;
}
}
return super.onGenericMotionEvent(event);
}
android鼠标滚轮事件监听方法
王的备忘录2023-10-26 13:03
相关推荐
dadaobusi几秒前
RISC-V 虚拟化:虚拟机TLB处理程序猿乐锅10 分钟前
【 苍穹外卖day03 | 菜品管理 】雾削木12 分钟前
B语言经典教程现代化重构凤山老林13 分钟前
JDK 11 升级至 JDK 17指令集梦境18 分钟前
图解:单调栈算法模板(Java语言)IronMurphy25 分钟前
多线程问!vx-Biye_Design26 分钟前
springboot安阳地区研学旅游服务小程序-计算机毕业设计源码12785whaledown33 分钟前
Kafka 与 Java 消息队列入门:用订单场景理解核心机制lichong95134 分钟前
让AI自己用电脑!Cua:后台操作鼠标键盘,Mac/Windows/Linux全支持Moshow郑锴38 分钟前
Ubuntu用SDKMAN轻松管理多个Java 版本