@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
相关推荐
ps酷教程4 小时前
Jackson 解决没有无参构造函数的反序列化问题NiceCloud喜云4 小时前
Opus 4.8 的 Effort Control 怎么选:Low 到 Max 五档策略_日拱一卒5 小时前
LeetCode:994腐烂的橘子隔窗听雨眠5 小时前
Nginx网关响应慢排查手记智慧物业老杨6 小时前
智慧物业合同周期管理系统:从风险预警到智能交接的全流程数智化落地方案源码宝6 小时前
MES系统源码:Java8 + SpringBoot2.7 + MySQL8 + Redis,后端源码清爽易扩展JAVA社区6 小时前
Java高级全套教程(十)—— SpringCloudAlibaba超详细实战详解金銀銅鐵7 小时前
[Java] 如何理解 class 文件中方法的 descriptor?云烟成雨TD7 小时前
Spring AI Alibaba 1.x 系列【63】AI Agent 长期记忆憧憬成为java架构高手的小白7 小时前
苍穹外卖--day09