@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
相关推荐
神奇小梵14 小时前
安全和开发的需要了解的知识————下载内容的安全,和下载内容如何运行2501_9159090614 小时前
iOS 证书创建与管理 类型限制 p12 密码与云备份实操evans在进步14 小时前
LeetCode 17:电话号码的字母组合——Java DFS 回溯法详解2401_8504811715 小时前
UVA10391UQR15 小时前
一、Java基础高频面试题AC赳赳老秦15 小时前
网页公开附件自动采集:OpenClaw 批量下载页面内嵌 Word/Excel 附件,统一格式后结构化入库上海云盾商务经理杨杨15 小时前
Tomcat 弱配置漏洞渗透实战!批量 getshell 高频漏洞黄毛火烧雪下15 小时前
Service 推送 / Stub·Proxy 对调10mAh15 小时前
【Linux】error while loading shared libraries 怎么解决?——ldd、RPATH 与动态链接排错深念Y15 小时前
stable-diffusion.cpp 的 FLUX.2 Klein 9B 分步