@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
相关推荐
硬件学长森哥12 小时前
成像技术系列-3A算法基础SZLSDH12 小时前
专项治理场景下,数字孪生IOC的架构适配逻辑:以智慧河湖监管为例隐退山林12 小时前
JavaEE进阶:SpringBoot日志东风微鸣12 小时前
AWS 可靠性最佳实践:从架构设计到故障恢复一把梭敲敲千反田12 小时前
微服务基础唔6613 小时前
Android在局域网中搭建 MQTT服务器 协议V3.1.1ideal-cs13 小时前
总结:生产环境Logback日志配置模板与pattern格式案例ooseabiscuit13 小时前
Laravel3.x核心特性全解析凤山老林13 小时前
慢SQL治理:索引优化实战指南——从定位到优化的完整解决方案2601_9574188014 小时前
Android 手机如何通过 PTP / MTP 连接单反相机?源码级方案分享