开发者

How to disable GestureListener in android?

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>
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜