@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
相关推荐
SL_staff6 分钟前
中小离散制造如何用工艺路线模板解决‘人走流程丢’——JVS-APS 实践解析Kapaseker7 分钟前
没想到吧!Skill 也可以测试 — 小白都看得懂的 Skill 教程我命由我1234514 分钟前
Android 开发问题:使用 AndroidTreeView 时,自定义视图无法撑满父容器没文化的阿浩22 分钟前
【MySQL】数据类型冷雨夜中漫步34 分钟前
DeepSeek Harness:一切皆插件的 AI Agent 框架深度解析Nomarsgo41 分钟前
柔性生产平台工业显示解决方案——基于联控 Lionconit IFD-1901 工业显示器打造高可靠人机交互终端恋猫de小郭1 小时前
社区版 Dart macros?一个可以解决 JSON 序列化的Fluter “宏编程”第三方包mmsx1 小时前
Android Design 项目集合lhldsg1 小时前
社区健身系统开发实战:从需求分析到落地部署全流程指南覆东流1 小时前
4.Java运算符与表达式