@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
相关推荐
云和数据.ChenGuang7 小时前
Python 重写(Override)深度解析:从 MRO 到 super() 的完整机制摇滚侠7 小时前
《On Java 中文版 基础卷》阅读笔记 实现隐藏 12tongyiixiaohuang8 小时前
WMS已发货状态反写金蝶云星空:单策略实战教程万化冥合8 小时前
PyBox屏幕键盘如何辅助演示键盘操作?豪气的程序猿8 小时前
Windows 练字时空格键偶尔没反应?先排查焦点和键盘,再用键盘小鹿练习好的佩奇9 小时前
Dart 之类修饰符silvamux_9 小时前
10款模型写种草笔记:可发布性、返工来源与成本数据缺口复盘alexhilton10 小时前
用Konsist与Lint强制执行设计系统契约步行cgn10 小时前
StringHttpMessageConverter 详解:Spring MVC 中字符串读写的默认转换器摇滚侠10 小时前
《On Java 中文版 基础卷》阅读笔记 实现隐藏 11