@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
相关推荐
砍材农夫3 小时前
spring-ai 第四多模态API她说..6 小时前
Java 对象相关高频面试题庞轩px6 小时前
深入理解 sleep() 与 wait():从基础到监视器队列皮皮林5517 小时前
面试官:ZSet 的底层实现是什么?码云数智-大飞7 小时前
C++ RAII机制:资源管理的“自动化”哲学2601_949816587 小时前
Spring+Quartz实现定时任务的配置方法计算机毕设指导68 小时前
基于SpringBoot校园学生健康监测管理系统【源码文末联系】mysuking8 小时前
springboot与springcloud对应版本希望永不加班8 小时前
SpringBoot 数据库连接池配置(HikariCP)最佳实践迈巴赫车主8 小时前
蓝桥杯3500阶乘求和java