@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
相关推荐
lhldsg2 小时前
全民健身解决方案小程序开发:从0到1的技术实战flower_drop2 小时前
基于 WebUSB 与 CDP:在浏览器端实现 Android 设备通信与无证书抓包实践jason成都2 小时前
Spring WebFlux 适配达梦新方案|dm‑r2dbc:Netty 异步传输的实验性 R2DBC 驱动泡海椒3 小时前
内置SPI函数库详解:JQuick-Java Builtin工具类实战用法辰烨chenye3 小时前
LeetCode Hot 100 题解 · 二分篇小羊没烦恼!3 小时前
Hello Web API系列教程——Web API与国际化撩得Android一次心动4 小时前
Jetpack Compose 知识点整理1【个人用】小荷才露尖尖角,早有蜻蜓立上头4 小时前
过滤器的4种创建方式大圣编蚕5 小时前
Java ByteArrayInputStream 详解:从入门到实战程序员阿明5 小时前
idea把插件啥的不默认放在C盘