@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
相关推荐
掉鱼的猫2 小时前
把 OpenAPI 接入 Agent Harness:零代码让 Agent 听懂你的 REST APIlzhcoder2 小时前
Spring Boot 集成 Kafka:先跑通 Demo,再避开那 80% 的人踩过的坑plainGeekDev2 小时前
ProGuard → R8带刺的坐椅2 小时前
把 OpenAPI 接入 Agent Harness:零代码让 Agent 听懂你的 REST APIGeek-Chow3 小时前
微服务认证与授权:01 — 概念雨白3 小时前
C 语言字符串:从字符数组、指针到核心操作实战KobeSacre3 小时前
DelayQueue 源码Wang's Blog3 小时前
JavaWeb快速入门: Filter与Listener核心详解zfoo-framework3 小时前
mongodb性能调优 1.从慢查询分析索引 2.掌握索引最左匹配原则!!!AIGS0013 小时前
企业AI落地:从RAG到AgentRAG的技术跃迁