@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 Jakarta Validation 实战指南:从参数校验到分组、自定义注解和全局异常处理jvmind_dev13 小时前
第一章:AI Agent 如何重新定义 Java 性能分析从此以后自律14 小时前
Java 并发编程完整讲解Sylvia33.14 小时前
足球数据接口开发实战:如何用火星数据API盘活赛事应用小小放舟、14 小时前
PaiCLI-Demo:从零实现 ReAct Agent + Tool Call千里马学框架14 小时前
google官方Perfetto 中使用 AI相关skillch.ju14 小时前
Java程序设计(第3版)第四章——匿名内部类C++、Java和Python的菜鸟15 小时前
第2章 前端Web基础(js、vue+Ajax)harmful_sheep15 小时前
idea相关设置zhangphil16 小时前
Android RecyclerView图像类ViewHolder离屏缓存数量直接增加Java/View对象内存,间接增加Graphics/GL内存