@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
相关推荐
MacroZheng16 小时前
阿里又开源了一个神级 Skill 项目!修罗-zero16 小时前
UI自动化开发(selenium):模拟人操作浏览器ruleslol16 小时前
Function Calling 讲解小小猪的春天16 小时前
MCP 半小时跑通和敢上生产之间,隔着这 5 个坑步行cgn17 小时前
Spring 注入 Properties 详解星空17 小时前
Map<String, String>`Map`是接口,不能直接 newliangbo717 小时前
12-JVM 调优方法论与参数速查干到60岁退休的码农17 小时前
16.过滤器中处理异常响应返回00后程序员张17 小时前
怎么用 Egret(白鹭引擎)打包 iOS 应用并上架 App Store?Java_2017_csdn17 小时前
StringUtils.hasText() 和 StringUtils.isNotBlank() 方法对比