@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
相关推荐
booboosui1 小时前
安卓 8.1 也能装了:代价是一条黄字和两个静默 bug小满、2 小时前
Java 值传递IT枫斗者枫哥2 小时前
Java 异步导出只测最终行数,为什么下载时仍会少一行?张紫娃2 小时前
idea 如何看一个类的 .class 文件南宫鑫2 小时前
Java底层实现AI人工智能+电脑小能手2 小时前
IP地址合法性校验,这个Java工具类4个方法纯字符不查DNS斯维赤2 小时前
SpringBoot接口调不通排查终极方案山楂树の3 小时前
Java BigDecimal笔记旋风菠萝3 小时前
HashMap和CurrentHashMap的key可以为空吗开开心心就好4 小时前
PDF水印怎么去掉?勾选对象再点匹配