@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
相关推荐
chde2Wang3 分钟前
hadoop部署错误-namenode address dfs.namenode.servicerpc-address not configured牛战士coding18 分钟前
Java 对象写入 Redis 后类型变了?Jackson 多态序列化问题复盘小白的码BUG之路22 分钟前
Jenkins -- 配置jdk和mavenxiaoqiMikko23 分钟前
Redis 实战(基础篇):把一个老 RedisUtil 搬到 Spring Boot 4,一路踩出来的坑(真机实测)镜象科技28 分钟前
职业院校AI心理健康解决方案是什么?从一台设备到全周期守护yuniko-n28 分钟前
【JUC】读写锁yuzhiboyouye39 分钟前
后端怎么评估工作量java资料站39 分钟前
十五、Spring AI Alibaba · 高级 ·Graph码上有光1 小时前
Linux:信号的认识、信号的产生、信号的保存、信号的处理金銀銅鐵1 小时前
[Java] 用 GUI 展示 ArrayList 扩容的过程