@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
相关推荐
计算机学姐8 分钟前
基于SpringBoot的旅游系统的设计与实现卷心菜的学习路13 分钟前
Spring Boot 多数据源落地:AbstractRoutingDataSource + 注解切面(附源码)秋饼16 分钟前
Spring AI AgentCore SDK 企业级实战:@AgentCoreInvocation 一注解替代 3000 行 Runtime 契约Yyyyyy~25 分钟前
【java】运算符古法安卓33 分钟前
Android-切换白天黑夜内存不足问题排查聚美智数37 分钟前
快递拦截-物流在途拦截-在途拦截API接口介绍Dreams_l40 分钟前
如何保证RabbitMQ消息可靠传输MacroZheng43 分钟前
面试官皱眉:"你懂 Vibe Coding,那你说superpowers和grill-me怎么选?",我:"小孩才做选择,我全都要!"flower_drop44 分钟前
从 QtScrcpy 到 TabQA:如何在浏览器侧边栏搞定 Android 投屏与测试提单?大模型码小白44 分钟前
【AI大模型】DeepSeek Harness 深度解析:大模型评测框架的架构与实践