@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
相关推荐
booboosui4 小时前
清单 40 件是硬上限:过期的活挂了 48 小时才被打标记FlightYe4 小时前
linux系统编程(二十一):C 语言常见坑方白羽5 小时前
SP vs DataStore:解锁 Android 本地存储的并发秘密GY-935 小时前
【Android】View和Componse摇滚侠6 小时前
《On Java 中文版 基础卷》阅读笔记 内部类 21王二蛋与他的张大花7 小时前
后台内存 827MB,我一行业务逻辑都没改就砍到 100MBPaper_Love7 小时前
android安全公告网站凌冰_8 小时前
数据结构 - 线性结构(三)Rain的Java大神之路9 小时前
Spring AI 2.0 GA 深度复盘:Java 后端做 AI 的分水岭,到底画在哪?