@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
相关推荐
devilnumber3 小时前
Java 递归算法 详解 + 核心要点 + 实战运用 + 避坑指南alexhilton3 小时前
Android的Agent优先时代:构建时vs运行时asdfg12589634 小时前
JavaBean是什么?怎么理解?有什么用途?Cutecat_4 小时前
视频字幕处理工具横向:提取模式 vs 编辑模式,该如何选择2601_961765295 小时前
【分享】PlayerPro媒体音乐播放器 完整专业版摇滚侠6 小时前
SpringMVC 入门到实战 文件上传 75-77GIS数据转换器6 小时前
城市排水生命线安全运行监测平台深度解析华如锦6 小时前
面了很多 Java转AI Agent方向,一些面试题总结睡不醒男孩0308236 小时前
CLup 6.x 版本中针对StarRocks 存算一体集群的完整操作手册程序员黑豆7 小时前
Java中怎么实现字符串拼接呢【AI全栈开发】