@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
相关推荐
sharemylove2 小时前
Java集合框架全面详解FYKJ_20103 小时前
springboot众创项目团队管理系统94666-计算机课程设计、毕业设计摇滚侠4 小时前
《On Java 中文版 基础卷》阅读笔记 内部类 20好的佩奇4 小时前
Dart 之 JSON_祝你今天愉快5 小时前
Android 事件传递机制:[一] 事件分发机制详解FYKJ_20107 小时前
springboot贫困生认定管理系统59009-计算机毕业设计、课程设计考虑考虑7 小时前
JDK27中的结构化并发吃我一窝jio9 小时前
Java IO流核心分类与应用Digitally10 小时前
如何将电脑上的联系人传输到安卓手机(4 种方法)这个昵称不容易10 小时前
租房管理系统设计与实现:16 张表、185 个接口的 SpringBoot 前后台项目