@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
相关推荐
疯狂打码的少年2 小时前
【数据库技术】关系模型基本概念(关系/属性/元组/键)Mr数据杨4 小时前
【Codex】用学生入学评估模块建立新生能力画像2601_962056234 小时前
Spring Boot 入门 与 无法解析符号 springframework 的解决●VON4 小时前
谁小时候不想要一个游戏修改器?我把电脑 Skill 做成了 Android 小助手Thomas21435 小时前
Java scala 数组 链表刃神太酷啦5 小时前
Linux 系统 MySQL 完整安装配置教程:从卸载 MariaDB 到优化 my.cnf----《Hello MySQL!》(1)里欧跑得慢5 小时前
Flutter 三方库 function_tree — 鸿蒙应用开发中的动态数学公式解析与计算神器,实现鸿蒙深度适配下的复杂函数逻辑运行时求值实战(适配鸿蒙 HarmonyOS Next ohos)亚历克斯神5 小时前
低代码与 AI 的融合趋势——从可视化搭建到自然语言生成应用IT毕设实战小研5 小时前
基于安卓的空气质量查询系统学长毕业设计5 小时前
基于SpringBoot的瑜伽馆网站的设计与实现(源码+文档+讲解视频)