@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
相关推荐
Nyarlathotep011314 小时前
SpringBoot Starter的用法以及原理wuwen514 小时前
WebFlux + Lettuce Reactive 中 SkyWalking 链路上下文丢失的修复实践SimonKing15 小时前
GitHub 10万星的OpenCode,正在悄悄改变我们的工作流黄林晴15 小时前
告别 Modifier 地狱,Compose 样式系统要变天了Seven9716 小时前
虚拟线程深度解析:轻量并发编程的未来趋势雨中飘荡的记忆1 天前
ElasticJob分布式调度从入门到实战冬奇Lab1 天前
Android触摸事件分发、手势识别与输入优化实战城东米粉儿1 天前
Android MediaPlayer 笔记Jony_1 天前
Android 启动优化方案阿巴斯甜1 天前
Android studio 报错:Cause: error=86, Bad CPU type in executable