@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
相关推荐
短剑重铸之日5 小时前
《ShardingSphere解读》07 读写分离:如何集成分库分表+数据库主从架构?知我Deja_Vu5 小时前
【避坑指南】ConcurrentHashMap 并发计数优化实战谢白羽6 小时前
vllm实践daidaidaiyu6 小时前
Spring IOC 源码学习 事务相关的 BeanDefinition 解析过程 (XML)电子云与长程纠缠7 小时前
Godot学习03 - 实例化、层级访问、Export毕设源码-朱学姐7 小时前
【开题答辩全过程】以 基于Android的便民系统的设计与实现为例,包含答辩的问题和答案鬼蛟7 小时前
Spring————事务西门吹-禅8 小时前
【sap fiori cds up error】敲代码的嘎仔8 小时前
Java后端面试——SSM框架面试题大傻^8 小时前
Spring AI Alibaba RAG实战:基于向量存储的检索增强生成