@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
相关推荐
北冥有鱼4 小时前
从 bean::method 里抠出注解:Java 方法引用元数据反查全记录CoderYanger5 小时前
Java EE 进阶:11. SpringBoot 统一功能处理(第四弹):@ControllerAdvice 源码分析+案例代码方白羽5 小时前
Android 开发中常见的编译加速方案StarsGreen8 小时前
Android VINTF 中 Device Manifest 与 Framework Manifest 详解玖米GEO运营王总监8 小时前
抖音和视频号算法区别:玖米快跑的双端分发信号与内容适配对比AI人工智能+电脑小能手9 小时前
集合按大小切片分批,这个Java工具类5个方法含基本类型数组SimonKing9 小时前
高星红果短剧的TV版|桌面版都在这里了Name_NaN_None10 小时前
安卓手机远程控制电脑方法(Android/Windows) —— 「小白教程」恋猫de小郭10 小时前
Flutter Perfetto:Dart Heap Sampling 终于要接入 Android 原生内存分析了Rain的Java大神之路10 小时前
大四 Java 校招速成路线:从高频八股到可部署项目,30 天、8 周、12 周都能照着练