@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
相关推荐
独泪了无痕2 小时前
探索Pinyin4j-Java中的拼音转换利器道尔柯南3 小时前
C++ string 类详解:从常用接口到深拷贝,彻底掌握字符串处理唐诺4 小时前
5、Android JNI 动态注册中的“签名“详解kingx34 小时前
Bugku 3122 谷歌小恐龙题解:纯离线逆向 Vault 的 AES-GCM 加密资源(附 Python 解密器)DevOpenClub6 小时前
职教高考控制线 API:招生类别枚举、筛选与空分数含义露天赏雪7 小时前
第3篇:Sentinel熔断降级实战:大模型接口抖动时的服务兜底方案zhaoshuzhaoshu7 小时前
Android 系统启动与调试中的日志抓取方式全解析天天被压力8 小时前
【A股分钟级高频数据完全手册 #06】北交所分钟级数据接口:京市股票Pro版最新分时天天被压力8 小时前
【A股分钟级高频数据完全手册 #05】指数历史分钟数据接口:Pro版沪深指数分时回放captain3768 小时前
▲统一功能——DispatcherServlet源码分析