@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 小时前
KMP全栈开发:从Android到AI Agent的技术演进与实践YM52e8 小时前
鸿蒙Flutter Padding内边距:EdgeInsets详解前端工作日常11 小时前
我学习到的Java中domain和dto区别码农学院11 小时前
基于Spring Boot的跨境电商多语言订单管理系统架构设计Rex叶然11 小时前
ScreenMatch适配安卓屏幕脚本,用于老项目阿pin11 小时前
Android随笔-Activity启动流程深度分析技术小结-李爽12 小时前
【工具】pom文件的<packaging>l1564694812 小时前
突围!图文混合知识库难以解析,Kimi-K3 原生视觉架构深耕知识工作,DMXAPI 统一接口,缩短项目开发周期zzq779712 小时前
加固包闪退四象限定位:targetSdk 与保护策略实战解析夏星印13 小时前
禁用笔记本自带键盘