@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
相关推荐
冬奇Lab13 小时前
PowerManagerService(下):Doze模式与电池优化砖厂小工15 小时前
Compose 中函数引用 vs Lambda:到底该用哪个?架构师沉默16 小时前
别又牛逼了!AI 写 Java 代码真的行吗?后端AI实验室21 小时前
我把一个生产Bug的排查过程,交给AI处理——20分钟后我关掉了它凉年技术1 天前
Java 实现企业微信扫码登录狂奔小菜鸡1 天前
Day41 | Java中的锁分类hooknum1 天前
学习记录:基于JWT简单实现登录认证功能-demo程序员Terry1 天前
同事被深拷贝坑了3小时,我教他原型模式的正确打开方式NE_STOP1 天前
MyBatis-缓存与注解式开发码路飞1 天前
不装 OpenClaw,我用 30 行 Python 搞了个 QQ AI 机器人