@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
相关推荐
小羊没烦恼!2 小时前
微服务化的基石——持续集成俊昭喜喜里2 小时前
java中的继承和多态的区别小羊没烦恼!2 小时前
初探性能优化——2个月到4小时的性能提升譕痕2 小时前
JSONObject与JSONArray封装数据格式区别千里马学框架2 小时前
一起学 Android 14:ShellTransition 屏幕旋转过程深度剖析美狐美颜SDK开放平台2 小时前
开发直播APP时如何接入视频美颜SDK?开发流程与注意事项胡写代码2 小时前
别再前后端各写一套表单校验了小鱼能吃糖3 小时前
缺陷修复总览 · mall电商项目:5类缺陷,1个病根,4个业务域AFinalStone3 小时前
Android7 SystemUI源码解析(七)Keyguard锁屏模块深度解析此时不提桶,更待何时3 小时前
01-06-A-JVM排查实战详解