@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
相关推荐
code_slave(码畜)13 小时前
微服务架构落地:基础服务 —— 报表服务(上篇:定位、边界与整体架构)不灭的黄金瞳12313 小时前
Java实现简易图书管理系统重生之小比特13 小时前
【C++进阶】02 Linux基本指令打工仔折腾 AI13 小时前
从零写一个CAD 04:中键拖动平移,抓住一个点让它一直待在鼠标底下Wang's Blog13 小时前
Java 项目实战: 外卖平台优化-Nginx常用命令与环境变量配置sp42a13 小时前
Java 加解密组件再设计FYKJ_201013 小时前
springboot家政服务平台66766-计算机课程设计、毕业设计caoerzhong13 小时前
开源 WMS 合规交付实务:JeeWMS 仓库管理系统在 GPL-3.0 下的源码台账与交付清单Brilliantwxx13 小时前
【STM32】 DMA 源码分析与实战(下):DMA 收发状态机与 HAL 分层ao-weilai13 小时前
MySQL数据库:数据类型