@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
相关推荐
摇滚侠6 分钟前
Vue 项目实战《尚医通》,完成确定挂号业务,笔记46正在走向自律14 分钟前
豆包编程模型Doubao-Seed-Code深度体验,从零开始构建全栈项目的完整指南钱多多_qdd18 分钟前
基础篇:IoC(九):应用上下文ApplicationContext月下的郁王子24 分钟前
进阶学习 PHP 中的二进制和位运算BrianGriffin25 分钟前
DcatAdmin框架小坑q***558931 分钟前
SpringSecurity 实现token 认证合作小小程序员小小店31 分钟前
web网页开发,在线%医院诊断管理%系统,基于Idea,html,css,jQuery,java,jsp,ssh,mysql。程序猿_极客1 小时前
【2025最新】 Java入门到实战:包装类、字符串转换、equals/toString + 可变字符串,一篇搞定开发高频场景(含案例解析)四谎真好看1 小时前
Java 黑马程序员学习笔记(进阶篇28)晨晖21 小时前
springboot的Thymeleaf语法