@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
相关推荐
青槿吖7 分钟前
第二篇:告别XML臃肿配置!Spring注解式IOC/DI保姆级教程,从入门到真香simplepeng43 分钟前
Room 3.0 KMP Alpha-01摇滚侠1 小时前
讲一讲 SpringMVC,线程变量 ThreadLocal 的使用Lei活在当下1 小时前
Windows 下 Codex 高效工作流最佳实践fatiaozhang95271 小时前
基于slimBOXtv 9.19.0 v4(通刷晶晨S905L3A/L3AB芯片)ATV-安卓9-完美版线刷固件包kuntli1 小时前
BIO NIO AIO核心区别解析Javatutouhouduan1 小时前
京东内部强推HotSpot VM源码剖析笔记(2026新版)imuliuliang2 小时前
怎么下载安装yarn曹牧2 小时前
在 Eclipse 中配置 Maven 和 Gradle 项目以支持增量打包_olone2 小时前
牛客每日一题:显生之宙(Java)