@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
相关推荐
众链网络6 小时前
Agent 重试的工程解法:幂等、断点续跑与熔断怎么落地Wang's Blog6 小时前
Java 项目部署之 Docker工具快速入门: 镜像命令从 pull 到 load 的完整实操Wang's Blog6 小时前
Java 项目部署之 Docker工具快速入门: Docker 数据卷命令与挂载实操云和数据.ChenGuang7 小时前
用 Claude Code 重构遗留系统:从评估到落地的完整指南霸道流氓气质7 小时前
AI 应用异常检测与根因分析:语义漂移检测、因果图推理与LLM-as-Judge的 Java 生产级实现xuxigifxfh7 小时前
牛客:BISHI2 【模板】栈的操作房开民7 小时前
通俗总结 Octree(八叉树)用户2181697049307 小时前
Kotlin 语法二2302_805771078 小时前
Day23:POM设计模式(封装)SL_staff8 小时前
APS降本增效的关键:在JVS中实现‘人-机-料-法-环’全要素耦合调度