@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 小时前
【Java 开发日记】HTTP3 性能更好,为什么内网微服务依然多用 HTTP2?HTTP2 内网优势是什么?雪碧聊技术6 小时前
大模型爆火!Java后端如何抓住Agent全栈开发的风口赏金术士6 小时前
Kotlin 数据流与单双向绑定逻辑驱动的ken7 小时前
Java高频面试场景题25小白学鸿蒙8 小时前
Unity 3D 2023解压安装,配置安卓运行环境后打包安卓应用(踩坑无数之差点放弃)AI人工智能+电脑小能手8 小时前
【大白话说Java面试题】【Java基础篇】第32题:Java的异常处理机制是什么阿巴斯甜8 小时前
2026小知识点(9)爱吃土豆的马铃薯ㅤㅤㅤㅤㅤㅤㅤㅤㅤ9 小时前
通过java后端代码来实现给word内容补充格式文本内容控件,以及 设置控件的标记和标题古月-一个C++方向的小白10 小时前
MySQL数据库——数据类型