@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
相关推荐
骇客野人16 分钟前
IntelliJ IDEA 菜单中英对照我命由我1234516 分钟前
Kotlin 面向对象 - 枚举排序Sam_Deep_Thinking37 分钟前
用Java 17从0到1写一个mini版RPC,理解远程调用的本质敲代码的嘎仔1 小时前
从零搭建微服务:Spring Cloud Alibaba 全家桶踩坑实录(Nacos + OpenFeign + Gateway + Sentinel)一条泥憨鱼2 小时前
苍穹外卖【day7| 对购物车进行操作】都叫我大帅哥13 小时前
Java JJWT 完全指南:从入门到生产级实践前端开发张小七14 小时前
Java 学习笔记 · 第一课:基础语法与核心概念ThsPool15 小时前
【ENVI二次开发学习整理 04】ENVI功能扩展与二次开发赤壁小虾16 小时前
【渲染流水线】[逐片元阶段]-[透明度测试]以UnityURP为例青山木17 小时前
Hot 100 --- 搜索插入位置