@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
相关推荐
Hello_Pyhx4 小时前
Hookshot v2.1.0:用键鼠玩《时之笛》,把操控和画面调顺手Lansonli4 小时前
大数据Spark(八十八):Spark任务资源之Standalone集群测试budingxiaomoli4 小时前
Spring AOP特立独行的猫A4 小时前
Ionic + 仓颉语言的 cj-tauri 开发框架实战:开发精美移动端 APPnice_lcj5204 小时前
LRU 缓存入门:它是什么、怎么用、面试怎么手写文丑颜不良啊5 小时前
LeetCode2741~2760题目解析Rattenking5 小时前
OpenCV 轨迹栏操作和键盘响应操作金銀銅鐵15 小时前
带您看懂字节码指令(二):空循环里有什么传奇开心果编程16 小时前
【Flutter踩坑排雷】第25课:ScrollController 误用坑|跳转失效、监听泄漏与“控制器未附加”吴名氏.16 小时前
Java转AI Agent教程(第十三周)混合检索与重排