@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
相关推荐
兄弟加油,别颓废了。10 分钟前
ctf.show_web4LSL666_16 分钟前
MybatisPlus条件构造器(上)U-52184F6931 分钟前
深入理解“隐式共享”与“写时复制”:从性能魔法到内存深坑bearpping34 分钟前
SpringBoot最佳实践之 - 使用AOP记录操作日志一叶飘零_sweeeet36 分钟前
线上故障零扩散:全链路监控、智能告警与应急响应 SOP 完整落地指南Skilce1 小时前
ZrLog 博客系统部署指南(无 War 包版,Maven 构建 + 阿里云镜像优化)敲代码的嘎仔1 小时前
Java后端开发——真实面试汇总(持续更新)迈巴赫车主1 小时前
蓝桥杯20560逃离高塔泯仲1 小时前
Ragent项目7种设计模式深度解析:从源码看设计模式落地实践春日见2 小时前
E2E自驾规控30讲:导论