@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
相关推荐
hai_android8 分钟前
SendChannel 与 ReceiveChannel 通信机制garmin Chen29 分钟前
redis面试题chen<>1 小时前
C++ 六种 memory_order:从原子性到线程间可见性.md十年Java程序媛1 小时前
SpringBoot3 + JDK17 实战复盘:HikariCP 连接耗尽,虚拟线程场景额外注意事项二十雨辰2 小时前
[Java]-JVM面试题cfm_29142 小时前
ConcurrentHashMap 线程安全机制与 JDK 1.8 演进tqs_123452 小时前
值传递与引用传递2601_962181962 小时前
Spring boot从0到1 - day01数据治理自习室2 小时前
AI 应用评测体系(GraphRAG)典典分享指南2 小时前
短视频分镜提示词:让 AI 出片的产品口播