@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
相关推荐
方也_arkling4 小时前
【Java-Day08】static / final / 枚举橙淮4 小时前
Spring Bean作用域与生命周期全解析Chengbei114 小时前
一站式源码安全检测工具、云安全 / APP / 小程序源码敏感信息递归多层目录扫描AK、JWT、手机号、身份证等敏感信息llz_1124 小时前
web-第一次课后作业秋95 小时前
Java项目运行5天左右自动宕机:系统性定位与解决方案小江的记录本5 小时前
【JVM虚拟机】垃圾回收GC:垃圾收集器:CMS:核心原理、回收流程、优缺点、废弃原因(附《思维导图》+《面试高频考点清单》)DIY源码阁5 小时前
JavaSwing学生成绩管理系统 - MySQL版Meteors.5 小时前
安卓源码阅读——01.grade设置binding为true时,xml如何进行映射_李小白6 小时前
【android opencv学习笔记】Day 26: 滤波算法之低通滤波与图像缩放插值basketball6166 小时前
C++ NULL 和 nullptr 区别 以及 nullptr 的核心实现