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