@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
相关推荐
人道领域8 分钟前
【LeetCode刷题日记】二叉树翻转:递归与迭代全解析Cyan_RA910 分钟前
SpringMVC 视图和视图解析器 万字详解alexhilton8 小时前
如何用Perfetto来对启动优化去伪存真想学习java初学者9 小时前
SpringBoot整合Vertx-Mqtt多租户(优化版)AC赳赳老秦9 小时前
政企内网落地:OpenClaw 离线环境深度适配方案,无外网场景下本地化模型对接与全功能使用赏金术士9 小时前
Kotlin 从入门到进阶 之函数模块(核心基础)(二)weixin_449173659 小时前
在 Java 中,线程安全的 List 主要有以下几种实现方式,它们的效率取决于具体的使用场景(尤其是读写比例):砚底藏山河9 小时前
股票数据API接口:如何获取股票历历史分时KDJ数据鱼儿也有烦恼10 小时前
8 issues were found when checking AAR metadata:MegaDataFlowers10 小时前
运行若依项目