@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
相关推荐
Resean0223几秒前
Spring 源码分析(七)AOP 原理(上):代理的创建Tangq一定可以的11 分钟前
Spring AI Advisor 详解 - 给大模型调用加上“切面“,日志/过滤/记忆一键搞定小巫编程室41 分钟前
我造了一个 Java 能力包:让 AI 直接调用你的业务代码深入云栈1 小时前
Netty 4.2.x 源码深度解析 (二十四):池化内存分配 —— PoolArena、PoolChunk 与 PoolSubpage惜.己2 小时前
Java结合idea简单使用PlaywrightVex2une3 小时前
JDK 8 下载安装与环境变量配置完整指南(Windows新手图文教程)文丑颜不良啊4 小时前
LeetCode3281~3300题目解析nice_lcj5205 小时前
【从零理解计算机网络 · 02】分层模型:别背 OSI 七层,看数据怎么被“打包“和“拆包“SimonKing6 小时前
给Deepseek Harness装上插件市场,从此插件无忧雨白6 小时前
Android 消息机制剖析:从 Handler 投递到 Looper 循环的全链路