@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
相关推荐
神仙别闹24 分钟前
基于 C++ 实现两个有序链表序列的交集swordbob1 小时前
ReentrantLock 与 AQS 完整学习手册aqi002 小时前
鸿蒙版本的JSBridge兼容与安卓配套的H5啦m0_587383002 小时前
全民健身解决方案软件开发实战:从架构设计到落地指南白山编程大哥2 小时前
Java OutputStreamWriter 详解:从字符到字节的桥梁事圆则缓2 小时前
MVVM 的理解与设计一技安身3 小时前
【信创】Docker‑Compose V2 两种离线部署(独立模式、插件模式)简易教程七夜zippoe4 小时前
为什么 2026 年每个 Java 团队都该懂 AI Agent码农阿豪4 小时前
我把 OpenClaw 装进旧安卓手机后,又折腾了 3 天:飞书、ADB、SSH 全部打通时凌云.4 小时前
【2026最新】JDK 下载安装与环境配置全教程(Windows/Mac/Linux 三平台,零基础友好)