@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
相关推荐
计算机毕业设计杰瑞1 分钟前
【计算机毕设精品】基于SpringBoot的一体化教务与学业质量管理系统的设计与实现,附源码_增删改查_java项目_可完美运行部署_网站项目硅基手札15 分钟前
【串口技术系列文档 10】低功耗与唤醒机制colinu17 分钟前
C++ 异步任务与线程生命周期:`std::async`、`future`、`thread`、`jthread` 与协作式退出大圣编蚕27 分钟前
初探 NDK 的世界:从零开始理解 Android 原生开发云贝贝贝27 分钟前
MySQL 慢查询定位与索引优化实战蜗牛互联网37 分钟前
Python + JSON Schema 实现工单结构化输出与本地复核逐光者93342 分钟前
STM32——SPI 屏 · Flash · 高速wuminyu1 小时前
ForkJoinPool窃取线程在扫描其他WorkQueue时的随机采样算法与Phase线程挂起唤醒机制解析Sarvartha1 小时前
内部类知识Knight_AL1 小时前
从 EasyExcel 到 Apache Fesod:Java Excel 处理生态的一次重构