@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
相关推荐
房开民9 分钟前
c++总结好大哥呀18 分钟前
C++ 多态毕设源码-赖学姐23 分钟前
【开题答辩全过程】以 基于Java的医院器材管理系统的设计与实现为例,包含答辩的问题和答案float_com32 分钟前
【java常用API】----- Arrays不会写DN1 小时前
PHP 中的文件读写与上传LuckyTHP2 小时前
迁移shibboleth java获取shibboleth用户信息客卿1232 小时前
数论===质数统计(暴力法,)华科易迅2 小时前
Spring 事务(注解)写代码的小阿帆2 小时前
Web工程结构解析:从MVC分层到DDD领域驱动东离与糖宝2 小时前
Java 26+Spring Boot 3.5,微服务启动从3秒压到0.8秒