@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
相关推荐
阿维的博客日记5 小时前
Hippo4j 线程池监控平台部署手册C+++Python7 小时前
详细介绍一下Java泛型的通配符开维游戏引擎8 小时前
AI自动生成游戏时,deepseek和mimo对比JosieBook8 小时前
【数据库】时序预测能力的分级进化:TimechoAI如何让每一类用户都能精准预见未来一生了无挂9 小时前
Java处理JSON技巧教学(从基础到高阶实战全覆盖)李白的天不白9 小时前
使用 SmartAdmin 进行前后端开发swordbob9 小时前
Spring 单例 Bean 是线程安全的吗?2601_9516437710 小时前
Python第一,Java跌出前三,C语言杀回来了IT 行者12 小时前
GitHub Spec Kit 实战(五):/speckit.tasks 怎么拆——Spec Kit 五部曲收官(Charon)12 小时前
【C++ 面试高频基础:指针、引用、const、static、new/delete 总结】