@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
相关推荐
皮皮林5514 小时前
IDEA 源码阅读利器,你居然还不会?用户2018792831677 小时前
Android黑夜白天模式切换原理分析芦半山8 小时前
「幽灵调用」背后的真相:一个隐藏多年的Android原生Bug卡尔特斯8 小时前
Android Kotlin 项目代理配置【详细步骤(可选)】ace望世界8 小时前
安卓的ViewModel白鲸开源8 小时前
Ubuntu 22 下 DolphinScheduler 3.x 伪集群部署实录ace望世界8 小时前
kotlin的委托ytadpole8 小时前
Java 25 新特性 更简洁、更高效、更现代纪莫9 小时前
A公司一面:类加载的过程是怎么样的? 双亲委派的优点和缺点? 产生fullGC的情况有哪些? spring的动态代理有哪些?区别是什么? 如何排查CPU使用率过高?JavaGuide10 小时前
JDK 25(长期支持版) 发布,新特性解读!