@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
相关推荐
CRMEB系统商城12 小时前
CRMEB标准版系统(Java)v3.1正式发布写后端的胖头鱼12 小时前
【高频面试题】Java 基础类型 + 包装类 + String 互相转换weixin_4604435612 小时前
企业考试系统从.NET迁移到Java+Linux:数据库迁移、接口兼容与灰度切换实践香菜TTT12 小时前
Redis的哨兵机制withoutfear13 小时前
IntelliJ IDEA卡顿内存分配不足和索引被频繁触发问题解决办法大圣编蚕13 小时前
Java StringWriter 详解:从入门到实战大佐不会说日语~13 小时前
Android 16 下 uni-app APP 提示“网络连接失败”的排障与修复老苗项目实战13 小时前
Java工程师高频面试题(基于近一年的真实面试记录整理)陈皮波比茶14 小时前
分布式任务调度xxl-jobXiaoYu1__14 小时前
JavaGUI文件管理系统开发实战:从静态展示到动态交互的演进