@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
相关推荐
要开心吖ZSH9 分钟前
MySQL 慢 SQL 排查操作手册-个人笔记版Joy T1 小时前
Spring AI 接入已有 Java 项目的三种架构设计杨运交1 小时前
[076][核心模块]构建优雅的Java异常处理框架:从错误码到全局异常处理caoerzhong2 小时前
仓库数字化成熟度分级:JeeWMS 开源 Java 仓库管理系统如何支撑从可见到自治的四级跃迁MayBaymax2 小时前
RocketMQ 存储机制程序猿_极客2 小时前
【免费】分享一套优质的基于SpringBoot的服装商城管理系统的设计与实现(带可视化图表、协同过滤功能),源码+文档+视频详解(讲解)用户3721574261352 小时前
Java 查找并高亮 Word 文字:精确查找及正则表达式模糊查找zyseo83 小时前
谷歌SEO 站内搜索优化实战:把站内搜索词变成关键词金矿bug菌3 小时前
🤔同事突然问我:Spring的注解 @Component 和 @Service 有何不同?佳児素花痴╮3 小时前
线程知识点