@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
相关推荐
时光足迹13 小时前
uni-app 视频通话实战:康复师与患者视频问诊的 6 个致命 Bug 与解决方案像我这样帅的人丶你还14 小时前
Java 后端详解(四):分页与搜索她的男孩14 小时前
数据权限为什么不能只靠注解?Forge 的 Mapper 层 SQL 改写源码拆解tntxia14 小时前
Mybatis的日志输入亦暖筑序16 小时前
Java 8老系统Browser Agent实战:三层拦截把AI操作后台变成可审计流程Coffeeee18 小时前
闲聊几句,Android老哥们,你们多久没做技改需求了萝卜er18 小时前
Fragment 生命周期与状态恢复-《Android深水区(四)》萝卜er18 小时前
Intent 显式、隐式与 PendingIntent-《Android深水区(五)》用户2986985301419 小时前
Java 实现 Word 文档加密与权限解除Yeats_Liao20 小时前
14:Servlet中的页面跳转-Java Web