@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
相关推荐
秋饼8 分钟前
Computer Use Agent Java 落地实战:感知-行动循环、执行器与安全围栏生产级实现好的佩奇13 分钟前
蓝牙之经典蓝牙文丑颜不良啊2 小时前
LeetCode2161~2180题目解析jllws12 小时前
键盘实现输入的思路传奇开心果编程3 小时前
【Flutter踩坑排雷】第19课:路由硬编码坑|字符串路由书写错误,页面跳转失败排查文丑颜不良啊4 小时前
LeetCode2141~2160题目解析LabVIEW开发4 小时前
LabVIEW 连接板:28 个端子怎么排,优先级怎么定天天被压力4 小时前
【A股分钟级高频数据完全手册 #07】北交所历史分钟K线接口:京市Pro版分时批量天天被压力4 小时前
【A股分钟级高频数据完全手册 #08】股票日、分时数据接口对比:普通分时与Pro版差异实测特立独行的猫A5 小时前
AI 时代,我为什么推荐用 cj-tauri 开发桌面应用