@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
相关推荐
weixin_7275356213 分钟前
Spring @Transactional 事务失效:原理层面深度解析没钥匙的锁11 小时前
16-Java反射机制:Spring IOC背后的核心技术geinvse_seg1 小时前
飞算JavaAI:把企业采购协同需求拆成一套可运行的慧采平台雨白2 小时前
嵌套 ScrollView 滑动冲突实战:实现内部优先滚动阿pin2 小时前
Android随笔-IntentService详解(了解)海天鹰2 小时前
content://com.android.externalstorage.documents/document/primary%3A烛影摇红透纱窗3 小时前
ForkJoinPool 与工作窃取浩瀚地学3 小时前
【面试算法笔记】0302-哈希表-哈希表实现阿pin3 小时前
Android随笔-WorkManager 与 AlarmManagerAC赳赳老秦3 小时前
时间开销自动统计:OpenClaw 记录工作任务时长、分析时间分配、给出优化建议