@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
相关推荐
无敌最俊朗@6 小时前
STL-vector面试剖析(面试复习4)PPPPickup6 小时前
easychat项目复盘---获取联系人列表,联系人详细,删除拉黑联系人LiamTuc6 小时前
Java构造函数长安er6 小时前
LeetCode 206/92/25 链表翻转问题-“盒子-标签-纸条模型”菜鸟plus+7 小时前
N+1查询我要添砖java7 小时前
《JAVAEE》网络编程-什么是网络?CoderYanger7 小时前
动态规划算法-01背包问题:50.分割等和子集2501_937189237 小时前
2025 优化版神马影视 8.8 源码系统|零基础部署菜鸟233号8 小时前
力扣513 找树左下角的值 java实现Neoest9 小时前
【EasyExcel 填坑日记】“Syntax error on token )“: 一次编译错误在逃 Runtime 的灵异事件