@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
相关推荐
白菜欣7 小时前
Linux — 进程控制budingxiaomoli7 小时前
Spring IoC &DISpider Cat 蜘蛛猫7 小时前
Springboot SSO系统设计文档未若君雅裁7 小时前
MySQL高可用与扩展-主从复制读写分离分库分表学习中.........8 小时前
从扰动函数的变化,感受红黑树带来的性能提升计算机安禾8 小时前
【c++面向对象编程】第24篇:类型转换运算符:自定义隐式转换与explicitweixin199701080169 小时前
【保姆级教程】淘宝/天猫商品详情 API(item_get)接入指南:Python/Java/PHP 调用示例与 JSON 返回值解析环流_9 小时前
redis核心数据类型在java中的操作雨辰AI9 小时前
SpringBoot3 项目国产化改造完整流程|从 MySQL 到人大金仓落地带刺的坐椅9 小时前
Java 流程编排新范式 Solon Flow:一个引擎,七种节点,覆盖规则/任务/工作流/AI 编排全场景