@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
相关推荐
萧曵 丶5 分钟前
JDK各版本新增特性详解TeleostNaCl6 分钟前
Android | 启用 TextView 跑马灯效果的方法毅炼29 分钟前
hot100打卡——day08a努力。38 分钟前
国家电网Java面试被问:慢查询的优化方案@小码农1 小时前
202512 电子学会 Scratch图形化编程等级考试四级真题(附答案)TheNextByte11 小时前
Android USB文件传输无法使用?5种解决方法程序猿ZhangSir1 小时前
深入理解 BIO,NIO,AIO 三者的用途和区别?Select,poll,epoll 操作系统函数简介智航GIS1 小时前
6.2 while循环2201_757830871 小时前
AOP核心概念为所欲为、Lynn1 小时前
用FastJson的Filter自动映射枚举