@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
相关推荐
敢敢J的憨憨L6 分钟前
GPTL(General Purpose Timing Library)使用教程sg_knight1 小时前
Spring Cloud与RabbitMQ深度集成:从入门到生产级实战雨白1 小时前
深入理解协程的运作机制 —— 调度、挂起与性能Chan161 小时前
批处理优化:从稳定性、性能、数据一致性、健壮性、可观测性五大维度,优化批量操作行者阿毅1 小时前
langchain4j+DashScope (通义千问)文生图Bug退退退1231 小时前
Java 网络流式编程IT机器猫1 小时前
RabbitMQ沐怡旸1 小时前
【Android】Android系统体系结构小杨的全栈之路2 小时前
冒泡、插入、选择、归并、堆排序:从名字由来到Java实现,一篇讲透yinke小琪2 小时前
面试官:谈谈为什么要拆分数据库?有哪些方法?