@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
相关推荐
CoderYanger15 小时前
Java EE:9.JVM(课件内容-上篇)xiaoqiMikko15 小时前
Spring Cloud Config 这个 CVE 的补丁,Maven Central 上根本没有残月心殇 请珍惜枸15 小时前
.NET陷阱之五:奇怪的OutOfMemoryException——大对象堆引起的问题与对策用户31268748772015 小时前
Spring Boot 配置体系到底怎么加载的?从 application.yml 到 @Conditional 的全链路拆解Bonnie_121515 小时前
08-JUC并发基础-AQS-补充共享锁小孔龙15 小时前
Android 图形系统全景Zane199415 小时前
线程池入门:7 大核心参数与 4 种拒绝策略Zldaisy3d15 小时前
连续纤维增材制造的机翼已飞上天,复材打印在低空飞行器上还需翻过几道坎?2501_9159214315 小时前
详细解析,iOS 应用上架 App Store 的完整流程与指南qq_4255161815 小时前
录音转文字工具免费下载:免费额度与功能限制对比