@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
相关推荐
毕设源码-赖学姐3 小时前
【开题答辩全过程】以 高校评教评学系统的设计与实现为例,包含答辩的问题和答案老华带你飞3 小时前
博物馆展览门户|基于Java博物馆展览门户系统(源码+数据库+文档)路边草随风4 小时前
iceberg 基于 cosn 构建 catalogIt's now4 小时前
Spring Framework 7.0 原生弹性功能系统讲解点PY4 小时前
C++ 中 std::async 和 std::future 的并发性_李小白4 小时前
【Android FrameWork】第二十四天:Activity生命周期是如何运行的ytttr8734 小时前
基于C#的CAN总线数据解析BMS上位机一 乐4 小时前
人事管理系统|基于Springboot+vue的企业人力资源管理系统设计与实现(源码+数据库+文档)带刺的坐椅4 小时前
Solon AI 开发学习19 - 结合 Solon Flow 实现 ReAct 效果CoderYanger4 小时前
Java SE——12.异常(≠错误)《干货笔记》