@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
相关推荐
FfHUCisI2 分钟前
Golang 数据库连接池深度调优程序员小八77740 分钟前
Java 快速转 Go职场的momo1 小时前
11个后端与AI岗位同时开放:Java、网关、推理优化怎么匹配罗超驿1 小时前
SpringMVC 请求参数接收详解|单个参数、多参数、对象参数、@RequestParam参数重命名古法安卓2 小时前
Android-epoll原理详解fireworks993 小时前
接口鉴权(401与403)wear工程师3 小时前
线程池里的异常去哪了?execute 和 submit 不是一回事孔明click333 小时前
别人绕过我的网关直接调用资源服务怎么办?使用 Sa-Token 解决:网关转发鉴权、RPC调用鉴权吴声子夜歌3 小时前
Java面试——设计模式(一)半亩码田3 小时前
C#转Python第3.6篇:Python 的 @property 比 C# 的 get/set 更灵活