@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
相关推荐
天河归来8 小时前
第三方接口不稳定,如何让核心任务继续完成好的佩奇8 小时前
蓝牙之通信架构FlightYe8 小时前
视界原理之3D视频(四):裸眼、眼镜和头显Knight_AL8 小时前
Java 文件下载时文件名中的 `#` 被转换成 `%23`?一次 URL 编码与解码问题排查诸神黄昏EX9 小时前
Android fw BatteryServicealexhilton9 小时前
提升 Android Compose 页面的流畅度砚底藏山河9 小时前
python量化自定义周期 K 线合成猿究院_夏燊10 小时前
MySQL 的四种隔离级别码流子11 小时前
移动收费怎么做?手持终端+App+收费中心的架构实践撩得Android一次心动11 小时前
Android中Gradle网络下载超时、更改存放位置(解决方案)