已解决
android鼠标滚轮事件监听方法
来自网友在路上 196896提问 提问时间:2023-10-26 20:31:13阅读次数: 96
最佳答案 问答题库968位专家为你答疑解惑
@Overridepublic 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);}
查看全文
99%的人还看了
猜你感兴趣
版权申明
本文"android鼠标滚轮事件监听方法":http://eshow365.cn/6-25384-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!