@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
相关推荐
栈溢出了13 小时前
Java Lambda 表达式笔记会周易的程序员13 小时前
使用 pybind11 封装 C++ 日志库 microLog 为 Python 模块zhixingheyi_tian13 小时前
一份GC日志的解读ywl47081208714 小时前
ArrayList和LinkedList内部的实现原理和区别沉静的小伙14 小时前
Spring事务花燃柳卧14 小时前
跨平台路由组件工程源码补充上传apihz14 小时前
随机驾考题目(C 照科一 / 科四 2000+ 题)免费API调用教程AIGS00114 小时前
企业AI落地:Agent OS 治理框架实践宸翰15 小时前
uni-app 设置 Android 底部虚拟导航栏背景色TechNomad15 小时前
Kotlin类对象与接口详解