@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
相关推荐
shehuiyuelaiyuehao9 小时前
算法18,二分查找Ehtan_Zheng9 小时前
Jetpack Compose 动画转换编排的艺术weixin_446729169 小时前
java网络通讯NE_STOP9 小时前
Redis--集群搭建与主从复制原理好奇的菜鸟9 小时前
Java开发常用中间件,Docker安装。许泽宇的技术分享9 小时前
别再把 AI Agent 当“会聊天的脚本”:Hermes Agent 源码级拆解(架构、框架、实战、趋势,一文吃透)Ehtan_Zheng9 小时前
Jetpack Compose 动画入门:轻松掌握状态驱动的动画转换程序员三明治9 小时前
【AI】Prompt 工程入门:从五要素框架到 RAG 生产级 Prompt 模板与 Java 实战旷世奇才李先生9 小时前
React 18\+Next\.js 14实战:服务端渲染与跨端开发全指南Ehtan_Zheng9 小时前
Jetpack Compose 布局与可见性动画