@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
相关推荐
KobeSacre11 分钟前
ForkJoinPool 源码wear工程师32 分钟前
Kafka 消费者心跳正常,为什么还会被踢出组?拆清 max.poll.interval.msSemiTris37 分钟前
为什么 C/C++ 不走 Java 式的虚拟机跨平台路线?汪海游龙38 分钟前
告别 Play Console 手动上传:从模拟器截图到自动发版的完整流水线weixin_440784111 小时前
【IntentSeivice实现原理】delta_hell1 小时前
【阅读源码--Android】动画之辅助类IanSkunk1 小时前
企业AI Agent生产化落地:从技术架构到实施服务的全链路分析岁岁养乐多1 小时前
Java 序列化相关问题小短腿乄2 小时前
java实现pdf加水印+签名云烟成雨TD2 小时前
Micrometer 系列【29】源码分析:MeterRegistry 实例化流程