@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
相关推荐
金銀銅鐵1 小时前
带您看懂字节码指令(番外二):递归里有什么——三层 fact 帧怎么叠起来两点王爷3 小时前
Java 面试高频:JWT、Cookie、Session、Token 鉴权详解悟道书生5 小时前
hashMap/hashSet/hashCode详解StarsGreen5 小时前
dumpsys gfxinfo数据信息分析方法好的佩奇6 小时前
蓝牙之 GATT 数据模型nice_lcj5206 小时前
依赖注入的三种方式:构造器、Setter、字段怎么选噢,我明白了6 小时前
实际项目导出方式应用Android小码家7 小时前
Systemui和Launcher是如何无限重启جيون داد ناالام ميづ8 小时前
七、MyBatis 源码剖析:核心流程拆解(初始化 + SQL 执行)