@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
相关推荐
Highcharts.js2 小时前
成分占比饼图代码|常用可视化图表开发示例西柚小萌新4 小时前
【人工智能:LangGraph】--3.控制流(Edge)金銀銅鐵4 小时前
带您看懂字节码指令(八):数组里有什么r_oo_ki_e_6 小时前
牛牛与切割机Rain的Java大神之路6 小时前
Spring Boot 3 升级实战:真正吃掉工期的,是 MyBatis-Plus 坐标和 Security 6 重写泡海椒6 小时前
Java PDF 报表开发:一页简历的两种版式风格对比与折行避坑wuminyu6 小时前
OpenJDK学习笔记:Native事件队列与Java回调背压源码_空间7 小时前
基于Springboot在线考试系统(源码+文档)@SmartSi7 小时前
AgentScope Java 入门 14:如何使用 PlanNotebook 让智能体学会“先规划,后执行“AI开源软件8 小时前
用MQTT跑通一台模拟设备:看懂IoT产品、物模型和告警