@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
相关推荐
yxlalm16 分钟前
2.java秒杀项目第二课-后端登录功能亦暖筑序1 小时前
AgentScope-Java 入门:用 SSE 展示评审任务进度TDengine (老段)1 小时前
TDengine SMA 索引 — 块级/文件级统计索引心中有国也有家1 小时前
AtomGit Flutter 鸿蒙客户端: AnimatedScale 与 AnimatedContainer 联合实战卓怡学长1 小时前
w261springboot基于web学校课程管理系统shuoshuohaohao1 小时前
《JavaWeb --2》浩瀚地学1 小时前
【面试算法笔记】0105-数组-螺旋矩阵AI人工智能+电脑小能手1 小时前
【大白话说Java面试题 第169题】【07_Redis篇】第5题:如何保证缓存一致性?SimonKing2 小时前
Spring I18N 底层源码大揭秘:你的 MessageSource 到底是怎么找到配置的?极客先躯2 小时前
高级java每日一道面试题-2026年04月04日-实战篇[Docker]-如何排查容器存储挂载失败的问题?