@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
相关推荐
随性而行3602 小时前
企业微信 API 如何实现业务消息自动通知?接口应用场景解析姜九笙5612 小时前
python学习---归来仍是新人HEJOO92 小时前
Java 并发运行中的安全问题详解2601_962106642 小时前
【无标题】朱涛的自习室2 小时前
预算 1000 美金的开源软件,DeepSeek 只花 1 美金就做完了(Day 6)汉吉龙测控技术3 小时前
激光对中仪作用介绍(AS 激光对中仪)Wang's Blog3 小时前
Java 项目实战: 交友项目 - 完善用户信息章节复盘:套路清单与自检清单硅基手札3 小时前
SPI技术系列 08 · SPI 控制器寄存器与 IP 架构用户3126874877203 小时前
Java 11-21 新特性盘点:var、record、sealed、虚拟线程TangGeeA3 小时前
命令安全设置