@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
相关推荐
2601_962071574 小时前
【Java报错已解决】org.springframework.beans.factory.BeanCreationException天空之城--5 小时前
Android Koin 完全指南:从原理到实践zww89491115 小时前
酒馆预约系统开发实战:从需求分析到上线全流程指南zhangphil6 小时前
Android main thread主线程Choreographer doFrame发生FullSuspendCheckzww89491117 小时前
匿名树洞系统开发实战:从需求分析到部署指南黑马程序员毕设8 小时前
基于Java的医院药品管理系统的优化设计与实现木井巳8 小时前
【BFS/DFS 解决 FloodFill 算法】太平洋大西洋水流问题白山编程大哥9 小时前
Java 集合算法:从排序、查找到底层原理的实战指南devpotato9 小时前
缓存与数据库更新顺序不一致问题xcl09259 小时前
酒馆预约系统开发实战:从需求分析到上线全流程指南