@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
相关推荐
用户51722315748019 分钟前
android资源类型与布局资源详细介绍优选资源分享1 小时前
GKD v1.11.6 | 安卓开屏广告跳过工具 可用版程序员buddha1 小时前
Java面试八股文高级篇yc_xym1 小时前
SpringAI快速入门robotx1 小时前
安卓zygote启动相关没有bug.的程序员1 小时前
S 级 SaaS 平台的物理雪崩:Spring Cloud Gateway 多租户动态路由与 UserID 极限分片你不是我我1 小时前
【Java 开发日记】我们来说一下 b+ 树与 b 树的区别左左右右左右摇晃1 小时前
Java笔记——反射左左右右左右摇晃2 小时前
Java笔记——IO