@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 小时前
Hot100中的:贪心专题myloveasuka6 小时前
Java与C++多态访问成员变量/方法 对比mygljx6 小时前
【MySQL 的 ONLY_FULL_GROUP_BY 模式】Andya_net6 小时前
Spring | @EventListener事件机制深度解析lang201509287 小时前
18 Byte Buddy 进阶指南:解锁 `@Pipe` 注解,实现灵活的方法转发重庆小透明7 小时前
【java基础篇】详解BigDecimal杰克尼8 小时前
苍穹外卖--day08lierenvip8 小时前
SQL 建表语句详解kuntli8 小时前
Spring Bean生命周期全解析ok_hahaha8 小时前
java从头开始-苍穹外卖-day06-微信小程序开发-微信登录和商品浏览