@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
相关推荐
CoderYanger4 小时前
Java EE 进阶:8.MyBatis 操作数据库(入门)(第二弹)CQU_JIAKE6 小时前
11.7[高体】apcipot_rain7 小时前
C++转Java日记(04)特立独行的猫A8 小时前
我给女儿写了个打字练习:一边敲键盘,一边把小学英语单词记牢憧憬成为java架构高手的小白9 小时前
LangGraph4j 实战(下)天诰10 小时前
SA-K-11 检索会消失吗与四个未解问题好的佩奇13 小时前
Dart 之扩展方法这个昵称不容易13 小时前
SpringBoot「衣依」服装销售平台:144个Java文件180个接口,从挑衣服到收货评价整条链路都在计算机毕设定制辅导-无忧学长14 小时前
《基于微信小程序的居家医疗陪护预约系统设计与实现》三少爷的鞋14 小时前
换个思路理解:非阻塞挂起