@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
相关推荐
布吉岛的石头27 分钟前
Java 程序员第 45 阶段11:网关统一路由大模型接口,配合 Nacos 配置治理,灰度路由:基于Nacos元数据实现大模型服务灰度发布与权重路由我命由我123451 小时前
Android 开发问题:Cannot resolve method ‘repeat‘ in ‘String‘baozhengw1 小时前
信创改造-SpringBootJar包改为WAR包部署TomcatM1A12 小时前
基于 Spring AOP 构建系统操作日志:从注解设计到异步落库的完整实战光头闪亮亮2 小时前
Fyne ( go跨平台GUI )项目实战-scanner摄像头扫码组件开发技术详解RainCity2 小时前
Java Swing 自定义组件库分享(十五)farerboy2 小时前
23-Java 构造函数Android打工仔2 小时前
Continuation 到底是谁创建的?坚持的小马2 小时前
Rocketmq搭建操作步骤DeepAgent2 小时前
AI Agent 工程实践(17):Agent 为什么需要可观测性(Observability)?