@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
相关推荐
d***81727 分钟前
解决SpringBoot项目启动错误:找不到或无法加载主类ᐇ95920 分钟前
Java集合框架深度实战:构建智能教育管理与娱乐系统zhaoyufei1331 小时前
Android13删除Taskbar听风吟丶1 小时前
MyBatis 深度实战:从基础映射到企业级性能优化仟濹2 小时前
【Java 基础】面向对象 - 继承6***83052 小时前
微服务搭建----springboot接入Nacos2.xlikuolei3 小时前
XML 元素 vs. 属性自不量力的A同学3 小时前
Spring Boot 4.0.0 正式发布d***29243 小时前
【spring】Spring事件监听器ApplicationListener的使用与源码分析5***b973 小时前
解决报错net.sf.jsqlparser.statement.select.SelectBody