@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
相关推荐
今天的砖头有点烫手啊4 分钟前
GC 算法与垃圾收集器演进:从 Serial 到 ZGC牧瀬クリスだ17 分钟前
Mybatis-Plus:让CRUD快如闪电盐焗鹌鹑蛋25 分钟前
【Linux】线程概念和控制CarIise37 分钟前
MyBatis缓存与分页插件:从一级二级缓存到底层原理与PageHelper实战宸津-代码粉碎机7 小时前
OpenAI 连夜迎战 Grok Bot 和 Muse:AI 智能体从 “会聊天” 到 “能办事”,现在入场还来得及吗噢,我明白了8 小时前
java中唯一键和幂等键的应用程序猿乐锅8 小时前
【黑马点评 | 第八篇】Redisson分布式锁考虑考虑9 小时前
synchronized字符串常量长谷深风1119 小时前
Tool与Skill:AI能力设计的分水岭m0_587383009 小时前
广州24小时自助健身房解决方案实战指南与系统部署要点