@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
相关推荐
yaoxin5211234 小时前
434. Java 日期时间 API - Period 基于日期的时间段何极光5 小时前
IDEA集成Maven程序员二叉5 小时前
【JUC】ThreadLocal底层原理|内存泄漏|弱引用|跨线程传递方案程序员二叉5 小时前
【JUC】线程池全套深度详解|参数|流程|拒绝策略|调优|异常处理老马识途2.06 小时前
在AI的帮助下理解spring的启动过程青山木6 小时前
Hot 100 --- 轮转数组Qt程序员6 小时前
掌握 Linux 内核调度:从原理到实现(进程篇)code bean6 小时前
【LangChain】检索器完全指南:从向量检索到生产级 RAG 架构大白菜和MySQL6 小时前
java应用排查高线程KobeSacre7 小时前
ReentrantLock源码