@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
相关推荐
廋到被风吹走1 分钟前
【数据库】【MySQL】InnoDB外键解析:约束机制、性能影响与最佳实践C++业余爱好者2 分钟前
Java 提供了8种基本数据类型及封装类型介绍想用offer打牌3 分钟前
RocketMQ如何防止消息丢失?皮卡龙6 分钟前
Java常用的JSON利刃大大1 小时前
【JavaSE】十三、枚举类Enum && Lambda表达式 && 列表排序常见写法float_六七1 小时前
Java反射:万能遥控器拆解编程han_hanker1 小时前
java 异常类——详解源码获取_wx:Fegn08951 小时前
基于springboot + vue健身房管理系统峥嵘life1 小时前
Android16 EDLA 认证测试CTS问题分析解决Mr1ght1 小时前
为什么 InheritableThreadLocal 在 Spring 线程池中“偶尔”能传递变量?——一次线程池上下文传播的误解