@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
相关推荐
2301_7807896610 分钟前
跨平台适配!SDK 游戏盾兼容全终端游戏场景学长毕设1 小时前
基于springboot的食品仓库管理系统步行cgn2 小时前
FormHttpMessageConverter 详解:Spring MVC 中表单数据的读写转换器龙亘川2 小时前
构建城市公共安全数字底座:亘川智城智慧安防系统全维度解读金銀銅鐵2 小时前
[Java] 用 CLI 展示 EnumMap 增删键值对时的内部变化秋天的怀念_David2 小时前
第二十二夜 · 数字迷雾Raas1002 小时前
AI网关部署方案?从部署到上线全流程niucloud-admin3 小时前
NIUCLOUD PHP SAAS上门家政使用文档:城市管理霸道流氓气质3 小时前
智能客服组件:分层意图识别、RAG Advisor 与人工转接状态机的 Vue3 + Spring AI 生产级实战captain3764 小时前
MyBatis操作数据库(入门2)