@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
相关推荐
wuqingshun31415913 小时前
重写equals而不重写hashCode,会出什么问题?我今晚不熬夜14 小时前
Java语言实现Modbus协议通过用串口读取数据(以RTU为例)小锋java123414 小时前
Maven 4 要来了:15 年后,Java 构建工具迎来"彻底重构"卓怡学长15 小时前
w269基于spring boot + vue 候鸟监测数据管理系统孫治AllenSun15 小时前
【MDC】使用 MDC 封装一个 LogMdcUtil 工具类济*沧*海15 小时前
BaseMapper的介绍plainGeekDev15 小时前
依赖管理 → Version Catalog淘源码d16 小时前
医学影像云PACS系统——PACS诊断工作站韩曙亮17 小时前
【Flutter】Flutter 进程保活 ③ ( 屏幕常亮设置 | Flutter 禁止息屏、关闭自动锁屏、屏蔽系统屏保 )KobeSacre17 小时前
Semaphore 源码