@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
相关推荐
杨杨杨大侠1 小时前
都能接模型、RAG 和 MCP,Java Agent 框架到底差在哪?Thinker QAQ2 小时前
并发编程(九):BlockingQueue 与 Channel——语言层的原子性、可见性与有序性朱涛的自习室3 小时前
我给 Gemini 4 和 DeepSeek 搞了套「末位淘汰」,AI 干活会更猛吗?(Day 3)霸道流氓气质4 小时前
RAG 可观测性与生产监控实战:四层遥测模型、五大仪表盘与 OpenTelemetry 全链路追踪的 Java 生产级实现AOI小白新手上路4 小时前
autodl常用的tar 打包下载(数据集)命令手册:逐段拆解与套用模板dishugj5 小时前
系统架构风险点、敏感点和权衡点的概念和区分苜蓿muxu6 小时前
常用代码命名规范马优晨6 小时前
JAVA 中 VO 实体类是什么意思,为什么要做这个Baron X6 小时前
Eclipse Temurin 21 (JRE) Alpine 镜像获取、离线导入与推送操作