@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
相关推荐
WiChP20 小时前
【V0.1B5】从零开始的2D游戏引擎开发之路cch891820 小时前
汇编与Java:底层与高层的编程对决荒川之神21 小时前
拉链表概念与基本设计cch891821 小时前
汇编与Go:底层到高层的编程差异chushiyunen21 小时前
python中的@Property和@Setter禾小西21 小时前
Java中使用正则表达式核心解析yoyo_zzm21 小时前
JAVA (Springboot) i18n国际化语言配置APIshop21 小时前
Java获取京东商品详情接口(item_get)实战指南Mr.Entropy21 小时前
springboot2.x集成Flyway