I have implemented GestureListener, and it is working perfectly, but how can I remove GestureListener from my view?
@Override
public boolean onTouchEvent(开发者_StackOverflow中文版MotionEvent event) {
if ( event.getAction() == MotionEvent.ACTION_UP ) {
// remove gestureDetector
} else {
mGestureDetector.onTouchEvent(event);
}
return true;
}
Regards, Nishant Shah
I'm not sure what you mean by "remove the gestureDetector".
Instead, you should consider passing the MotionEvent to the GestureDetector first, and processing the event yourself only if the GestureDetector does not, with something like this:
public boolean onTouchEvent(MotionEvent event) {
if (mGestureDetector.onTouchEvent(event)) {
return true;
}
<your code to process the event here>
}
精彩评论