@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
相关推荐
微尘寒风6 小时前
【Git】的安装和使用y = xⁿ6 小时前
DeepSeek Harness 学习日记:关于Agent接口,工具调用的底层实现侧耳倾听1117 小时前
jwt使用简介顶点多余7 小时前
那些在算法中适合巩固的知识点---1AI人工智能+电脑小能手7 小时前
大白话说Java设计模式-46-责任链模式(业务实战篇)jay神8 小时前
【计算机毕业设计】基于SpringBoot的程序教学辅助系统2601_962066498 小时前
【Sql Server】Update中的From语句,以及常见更新操作方式yaoxin5211239 小时前
507. Java 反射 - 在 BeanFactory 中实现依赖注入OPEN-F9 小时前
C++模板教程:变参模板、折叠表达式与SFINAE2601_9620722110 小时前
SpringMVC进阶(自定义拦截器以及异常处理)