@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
相关推荐
折哥的程序人生 · 物流技术专研1 天前
第4篇:Lambda 简化策略模式(Java 8+)私人珍藏库1 天前
[Android] PeakFinder AR v4.8.89 (山峰全景识别+增强现实山峰查看器)researcher-Jiang1 天前
高性能计算之OpenMP——超算习堂学习1alexhilton1 天前
Kotlin DSL深度解析:从Gradle脚本到构建你自己的DSL烽火聊员1 天前
查看Android Studio错误日志西门吹-禅1 天前
java springboot N+1问题DLYSB_1 天前
生命通道:如何用 HIS 医疗系统直连网络声光终端,打造“零延误”的危急值响应网关?weixin_BYSJ19871 天前
SpringBoot + MySQL 乒乓球运动员信息管理系统项目实战--附源码04954AI小码1 天前
LLM 应用的缓存工程:当每次 API 调用都在燃烧成本Hui Baby1 天前
Spring Security