@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 小时前
Kubernetes DNS 完全指南:服务发现核心机制与实践逻辑驱动的ken2 小时前
Java高频面试考点场景题14阿冰冰呀2 小时前
互联网大厂Java求职面试实录:谢飞机的“水货”之路水无痕simon2 小时前
1.单机部署Nacos1.3.2苦瓜花3 小时前
【Android】活动yv_303 小时前
XXE漏洞Java小生不才4 小时前
spring AI文生图苍煜4 小时前
ThreadPoolExecutor线程池终极全解:同步异步判定+SpringBoot生产实战c++之路5 小时前
C++ 动态内存小脑斧1239 小时前
安卓专属|青禾去水印 APP 免费无广告 多媒体素材处理工具