@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
相关推荐
皮皮林55110 小时前
拒绝写重复代码,试试这套开源的 SpringBoot 组件,效率翻倍~顺风尿一寸14 小时前
从 Java NIO poll 到 Linux 内核 poll:一次系统调用的完整旅程程途知微14 小时前
JVM运行时数据区各区域作用与溢出原理华仔啊16 小时前
为啥不用 MP 的 saveOrUpdateBatch?MySQL 一条 SQL 批量增改才是最优解xiaoye201819 小时前
Lettuce连接模型、命令执行、Pipeline 浅析beata1 天前
Java基础-18:Java开发中的常用设计模式:深入解析与实战应用Seven971 天前
剑指offer-81、⼆叉搜索树的最近公共祖先alexhilton1 天前
端侧RAG实战指南雨中飘荡的记忆2 天前
保证金系统入门到实战Nyarlathotep01132 天前
Java内存模型