@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
相关推荐
什巳3 小时前
JAVA练习278- 和为 K 的子数组豆瓣鸡3 小时前
RocketMQ学习-Spring Boot消息实践louisgeek3 小时前
Android Studio 和 Gitwuqingshun3141593 小时前
说一下mysql的覆盖索引罗超驿4 小时前
2.算法效率的核心密码:时间复杂度和空间复杂度详解栈溢出了4 小时前
Redis 分片集群与哈希槽笔记遨游DATA4 小时前
Spring Boot 启动失败排查:如何区分多 Bean 冲突与清理阶段异常wabs6665 小时前
关于单调栈【力扣739.每日温度的思考】雪碧聊技术5 小时前
为什么要学函数式编程?爱吃提升5 小时前
Python桌面自动化PyAutoGUI完整实战教程:模拟鼠标键盘、窗口操作、图形识别自动化