@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
相关推荐
alexhilton3 小时前
MVI模式的完整历史、误解和现代Android范式阿维的博客日记6 小时前
MultipartFile 是不是表示仅仅是一个分片?程序员无隅6 小时前
Coding Agent 为什么压缩上下文后还能继续工作?上下文模块设计拆解Python+997 小时前
Java 枚举类(Enum)详解:从基础到高级应用二炮手亮子7 小时前
浅记java线程池一路向北North7 小时前
Spring Security OAuth2.0(23):分布式系统授权-转发明文给微服务心中有国也有家9 小时前
AtomGit Flutter 鸿蒙客户端:Canvas 绘制进阶-路径、渐变与混合模式爱吃牛肉的大老虎9 小时前
rust基础之环境搭建tellmewhoisi10 小时前
多版本共用redis的token有效期校验(过期重新登录)疯狂打码的少年10 小时前
【软件工程】结构化设计:模块独立性与耦合内聚