本文介绍了OnUp上GestureDetector事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的问题很简单,在实施GestureListener的时候是在onUp事件?
My question is simple, where's the onUp event when implementing a GestureListener?
我有很多对gesturedetector事件,而不能只消耗听者的onUp事件,引起的事件之一是需要它的onSingleTapConfirmed
I has a lot of events on the gesturedetector, and cannot just consume the onUp event of the listener, cause one of events are the onSingleTapConfirmed that needs it.
推荐答案
尝试使用onFling()。似乎是一个奇怪的名字,但对我来说,它的工作原理为onUp()方法将逻辑地工作。或者试试这个方法...
Try using onFling(). Seems like a weird name but for me, it works as the onUp() method would logically work. Or try this method...
@Override
public boolean onTouchEvent(MotionEvent me) {
Log.v("ADAM", "ontouch: " + me.getAction());
if(me.getAction() == 0){
Log.v("ADAM", "Down");
}
else if (me.getAction() == 1) {
Log.v("ADAM", "Up");
}
else if (me.getAction() == 2) {
Log.v("ADAM", "Scroll");
}
boolean detectedUp = event.getAction() == MotionEvent.ACTION_UP;
if (!mGestureDetector.onTouchEvent(event) && detectedUp)
{
return onUp(event);
}
return true;
}
这篇关于OnUp上GestureDetector事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!