@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
相关推荐
文丑颜不良啊3 小时前
LeetCode2261~2280题目解析TimeFine3 小时前
AI 编程工作流的设计:从人工判断到 AI裁判SL_staff3 小时前
告别规则黑盒:JVS-Rules 在金融风控中的可视化决策编排实践阿杰m4 小时前
Android源码第四章:Android 系统启动——App 的第一行代码从哪来?逃逸线LOF4 小时前
服务网关Gateway灿飞屋4 小时前
Kotlin与Java虚拟机四:函数阡陌数智5 小时前
Claude API新版本重大变更与安全升级指南学长毕设7 小时前
基于SpringBoot的野生动物公益保护平台设计与实现-附源码SL_staff8 小时前
离散制造排程破局:JVS-APS 四步闭环落地实践(开发者视角)这个昵称不容易8 小时前
SpringBoot 美容院管理系统:232个Java文件315个接口,5套角色从预约到发货一整条链路