Android GestureOverlay with vertical and horizontal strokes

I'm currently trying to implement GestureOverlay to capture both vertical and horizontal strokes at the top of my view. Usually this function is not accepted, as it assumes that you are applying over a scrollable view.

Using android: orientation I can set it to capture one or the other, but I need to know if there is a way to override this to accept both options, or if I am stuck with a custom gesture adapter.

Thanks Josh McKinney

+3
source share
2 answers

The android: orientation = "none" parameter is part of the Replicant project and is not valid for standard Android builds. In short, the only options you have are horizontal and vertical, sorry.

0
source

Which handler are you using with your GestureOverlayView? OnGesturePerformedListener or OnGestureListener? If you use OnGesturePerformedListener, you will be limited by the orientation of your screen. You must use OnGestureListener and implement the onGestureEnded function. It gives you a completed gesture regardless of the orientation of your screen:

@Override
    public void onGestureEnded(GestureOverlayView overlay, MotionEvent event) {
        Gesture gesture = overlay.getGesture();
        // Here you can check it against your saved gestures in the gesture library

    }

Cheers Amin

0
source

Source: https://habr.com/ru/post/1787930/


All Articles