@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
相关推荐
我登哥MVP12 小时前
Spring Boot 从“会用”到“精通”:ReturnValueHandler原理snow@li12 小时前
数据库:MySQL vs PostgreSQL 详尽对比(2026版)丑过三八线13 小时前
Runc 深度解析:从原理到实操STDD13 小时前
ntfy 自托管推送通知服务搭建:一条 curl 命令向手机发送通知数智工坊13 小时前
【ROS 2 全栈入门指南三】:Action、参数与Launch文件全链路指南周末也要写八哥13 小时前
线程的生命周期之线程睡眠炸薯条!13 小时前
二叉树的链式表示(2)徐寿春13 小时前
什么是数据倾斜李白的天不白13 小时前
一个服务器可以搭建多个网站