@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
相关推荐
星空1 小时前
金蝶苍穹build.gradle配置步行cgn4 小时前
Spring 基于 XML 的自动装配:byName 详解大帅点兵4 小时前
Apache Ant 1.9.9 完整讲解LuTshoes4 小时前
spring ai 实战 手搓 PlaneExecuteAgent这料鬼有毒5 小时前
二刷hot100-73.矩阵置零caoerzhong5 小时前
JeeWMS 开源仓库管理系统二次开发与接口对接实战:Java WMS 如何与 ERP、MES 和自动化设备打通长谷深风1115 小时前
评测AI Agent:三种裁判各司其职边境悍匪5 小时前
蜗牛学苑 Java 智能体学习 Day42|项目周开发技术汇总 1 思维导图复盘槑有烦恼5 小时前
Java 字符串 & List集合 高频易错真题复盘(含全部错题+修正)语戚5 小时前
力扣 1621. 大小为K的不重叠线段的数目:动态规划(Java 实现)