@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
相关推荐
weixin_394758034 小时前
CRMEB Pro 优惠券:下单怎么核销,取消/退款怎么返券EatFan4 小时前
Spring Boot 4.0 升级清单:JDK 基线、Jakarta 命名空间、Observation API 与第三方组件兼容一次讲清辰海Coding4 小时前
平台如何接入一台物联网设备?又该如何设计它的通信协议?代码民工正电荷4 小时前
JAVA重要知识点和集合alexhilton6 小时前
Android 17 内存预算成为必修课李少兄6 小时前
IDEA Apifox Helper 插件踩坑:2.0.15-243 版本“导出指定接口”参数描述丢失问题解析与修复方案努力攀登的小k6 小时前
《新手练表:从建表到删表全操作|从零学会表操作》Yetian_20007 小时前
Postman测试上传图片文件接口爪哇碎碎念7 小时前
【Java】从一次 cache.get(key) 进去:缓存击穿一瞬间打出 200 次 DB,JDK 17 实测三种解法csdn_aspnet7 小时前
Java 使总距离最短的最佳点位置(Optimum location of point to minimize total distance)