@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
相关推荐
·薯条大王7 小时前
经济实惠玩云服务器|一台云服务器多人共用,子账号配置教程YB13759 小时前
jetpack compose 副作用 SideEffect秋枫要学习10 小时前
你的鼠标,正在被 AI 抢走ZJH__GO10 小时前
网络编程v4pro--实现聊天室文件传输功能程序员黑豆10 小时前
Windows 系统 Java 环境变量配置全攻略:解决“不是内部或外部命令”命运之光10 小时前
【C语言完整代码】就诊信息管理系统凤山老林10 小时前
Spring Boot @Async 线上实战:从默认配置到生产级线程池治理CHB11 小时前
uni-app x 蒸汽模式 性能测试基准报告 Benchmark【Android版】marvelyu11 小时前
每天10分钟学会OceanBase系列(Day 20):跨机房容灾实战——构建多数据中心高可用架构带娃的IT创业者12 小时前
拆掉那堵墙:LibrePods 如何让 AirPods 在 Android 上重获新生