@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
相关推荐
IT枫斗者枫哥2 小时前
MyBatis一对多分页:LIMIT 20,为什么凑不齐20个订单?代码方舟2 小时前
Java数据工程:利用天远全网运营商三要素优化线上实名认证合规体验BBmmo2 小时前
我的 Java 学习笔记 · 第 7 篇:泛型与通配符独泪了无痕2 小时前
Hutool之RandomUtil:随机数生成的终极利器花开路口2 小时前
深入理解 Java/Kotlin 协变与逆变运行时异常2 小时前
【WMS 仓储系统集成 AI Agent 实战】第 7 讲:Vue3 前端工程化——Token 刷新锁、Markdown 渲染踩坑与权限体系她的男孩2 小时前
开放接口限流从 20 改到 200 还是每分钟 20 次:拆完防重放+幂等+限流,我找到 5 个静默失效的坑_祝你今天愉快2 小时前
UI核心 - UI绘制流程及原理天天被压力2 小时前
【Python 量化取数指南 #13】Python 把行情落库:sqlite 一键存,回测随用随取天天被压力2 小时前
【Python 量化取数指南 #14】Python 清洗行情数据:复权停牌对齐,回测不翻车