@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
相关推荐
张某布响丸辣几秒前
附件下载的安全边界:路径白名单、NAS 哨兵文件与 Redis Lua 一次性令牌传奇开心果编程7 分钟前
【Jetpack Compose基础语法学与练】第8课 rememberSaveable,页面旋转/系统重建保留状态>Andre<26 分钟前
UFS5.0标准中文全译·卷一:范围、术语与架构YatHinLay40 分钟前
Spring Boot + Calcite 实现跨库查询酷炫码神1 小时前
MosMos 创意效果与能力边界展示Wang's Blog1 小时前
Java 接入Redis: 使用Jedis操作Redis事圆则缓1 小时前
Java 8 Lambda、Stream、Optional 与 Android 边界:从回调语法到运行时兼容shehuiyuelaiyuehao1 小时前
算法50,分治归并,数组中的逆序对烽学长1 小时前
(附源码)基于Springboot+vue的图书阅读分享系统的设计与实现mmsx1 小时前
Android 地图十万要素不卡顿:空间网格 + 渐进式加载的移动端实践