@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
相关推荐
yxlalm5 小时前
Spring AI+RAG 01-项目背景与技术选型程序员清风6 小时前
Java 后端高并发设计:线程池、限流、熔断与降级Seoyoneh6 小时前
Agentic Workflow编排架构:云客服从“被动响应”迈向“主动执行”的技术实现海南java第二人6 小时前
对外 API 如何保证幂等性?插入数据 / 上传表格场景全方案汇总tryxr7 小时前
Chat2Excel 文件服务模块上传文件功能开发Tangyuewei7 小时前
Java 写 Agent:模型只是组件tianshi48517 小时前
Android 应用启动窗口(Splash Screen)的创建与销毁流程脚踏实地,坚持不懈!7 小时前
ICU Calendar 实际工作问题排查手册ii_best7 小时前
安卓脚本/ios开发软件按键精灵实战:自动定位弹窗广告关闭按钮坐标的通用方案彧azz8 小时前
Java学习语法篇:变量