@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
相关推荐
也许明天y15 小时前
Spring AI 核心原理解析:基于 1.1.4 版本拆解底层架构小红的布丁15 小时前
BIO、NIO、AIO 与 IO 多路复用:select、poll、epoll 详解lifallen15 小时前
Flink Checkpoint 流程、Barrier 流动与 RocksDB 排障疯狂打码的少年15 小时前
【Day12 Java转Python】Python工程的“骨架”——模块、包与__name__希望永不加班15 小时前
SpringBoot 自定义 Starter:从零开发一个私有 Starter悟空码字15 小时前
别再System.out了!这份SpringBoot日志优雅指南,让你告别日志混乱一 乐15 小时前
工会管理|基于springboot + vue工会管理系统(源码+数据库+文档)callJJ15 小时前
Spring AI ETL 数据处理管道实战指南:从原始文档到向量索引暗暗别做白日梦16 小时前
Maven 内部 Jar 包私服部署 + 多模块父工程核心配置2501_9159214316 小时前
苹果iOS应用开发上架与推广完整教程