@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
相关推荐
戮戮27 分钟前
Spring Cloud Gateway 零拷贝参数校验:一种高性能网关架构实践提子拌饭13338 分钟前
番茄时间管理:鸿蒙Flutter 实现的高效时间管理工具alengan40 分钟前
cocos自动编译-Android自动出apk包漫霂44 分钟前
二叉树的统一迭代遍历文静小土豆44 分钟前
K8s 滚动更新在 Java 应用中的实践与优化HSunR1 小时前
java springboot3 后端 基础框架4311媒体网1 小时前
帝国CMS二次开发实战:精准实现“最新资讯”标识与高亮判断七夜zippoe1 小时前
Java技术未来展望:GraalVM、Quarkus、Helidon等新趋势探讨枫叶落雨2221 小时前
ClassPathXmlApplicationContext草莓熊Lotso1 小时前
【Linux 线程进阶】进程 vs 线程资源划分 + 线程控制全详解