@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
相关推荐
wangchunyu1145 小时前
JAVA CompletableFuture异步编程实战paopaokaka_luck6 小时前
流浪动物救助与收养系统(DeepSeek AI对话、 ECharts多维分析、救助流程衔接、领养与回访衔接、 捐赠确认与公示、志愿者协作)Thomas.Sir6 小时前
第9课:SpringBoot4.x Web开发基础:WebMvc自动配置、静态资源、请求参数接收程序 代码狂人6 小时前
切片表与分区表的区别(数据开发面试版)警醒与鞭策7 小时前
Codex桌面版与Claude桌面版使用设置2501_944521597 小时前
Deepmerge 跨端三方库仓颉适配全流程南归北隐8 小时前
Spring AI Alibaba Graph框架实现MCP数据库查询实战古法老登瞎折腾9 小时前
大数据智能运维实战(九):让 AI 查日志——找到异常,也保留上下文ai大模型-探索者9 小时前
Function Call与MCP(区别、联系与实战)略略略咯咯9 小时前
啊啊啊啊啊