@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
相关推荐
论迹复利3 小时前
FreeRTOS 在 RISC-V 上是如何“点火“的 —— 从 main() 到第一个任务的完整链路张宇Joaquin3 小时前
鲲鹏统一并行加速库KUPL--众核并行能力介绍宸津-代码粉碎机3 小时前
AI攻防战升级!基于Spring AI构建Java应用自动免疫安全体系2601_963749104 小时前
越华环保集团数字化污水治理:端边云采集架构与平台对接实现xcLeigh5 小时前
Go入门:整数类型的溢出与安全边界源码宝5 小时前
SpringBoot+Vue2 诊所门诊管理系统,完整前后端源码,可直接部署上线yychen_java5 小时前
九:Text-to-SQL 智能数据查询与 Human-in-the-Loop 人机协作lhldsg7 小时前
智慧场馆解决方案小程序开发实战:从架构设计到部署指南Freak嵌入式7 小时前
Pico UART 数据收发实战:硬件配置、MicroPython 编程devilnumber8 小时前
Oracle 与 MySQL substr 函数差异总结