@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
相关推荐
zdl6865 分钟前
springboot+全局异常处理2301_7717172112 分钟前
Jackson的使用方法详解huwuhang1 小时前
支付宝 APP 谷歌商店版 googleplay版最新立莹Sir1 小时前
Spring Bean生命周期设计思想与源码深度剖析:从表象到本质的全面升级计算机毕业论文辅导1 小时前
毕业设计避坑指南:工资信息管理系统的设计与实现(Java+SpringBoot实战)你不是我我1 小时前
【Java 开发日记】为什么要有 time _wait 状态,服务端这个状态过多是什么原因?User_芊芊君子1 小时前
别再乱用 ArrayList 了!这 4 个隐藏坑,90% 的 Java 开发者都踩过xcLeigh1 小时前
JAVA项目实战:用飞算 JavaAI 高效开发电商系统核心功能模块xcLeigh1 小时前
IoTDB Java 原生 API 实战:SessionPool 从入门到精通qq12_8115175151 小时前
Java Web 影城会员管理系统系统源码-SpringBoot2+Vue3+MyBatis-Plus+MySQL8.0【含文档】