@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
相关推荐
沐怡旸5 小时前
深入解析 Android Performance Analyzer (APA) 底层架构与技术原理吃饱了得干活11 小时前
Spring Cloud Gateway 微服务网关:路由、断言、过滤器李斯维13 小时前
从历史的角度看 Android 软件架构lwx5728013 小时前
探秘InnoDB:搞懂它的内存、线程、磁盘与日志刷盘策略Flynt14 小时前
从Spring Boot 4.0升到4.1,我在Maven和gRPC上栽了跟头plainGeekDev15 小时前
Activity 间传值 → Navigation 参数用户416596736935515 小时前
Android WebView 加载 file:// 离线页面调试教程plainGeekDev15 小时前
onActivityResult → ActivityResult APISunia15 小时前
《AgentX 专栏》10-生产部署:3台2C4G云服务器把企业级Agent真正跑起来的完整方案ZhengEnCi16 小时前
J7A-高级Java工程师面试三道灵魂拷问-深度广度与工程素养的终极检验