Android GestureOverlay with vertical and horizontal strokes
I am currently trying to implement GestureOverlay to capture both vertical and horizontal stro开发者_如何学运维kes on top my view. Typically this functionality is not accepted, as it assumes you are applying on top of a scrollable view.
Using android:orientation I am able to set it to capture one or the other, but I need to know if there is a way to override this to accept both, or if I am stuck using a custom gesture adapter.
Thank You, Josh McKinney
The android:orientation="none" option is part of the Replicant project and isn't valid for standard Android builds. In short, the only options you have are horizontal and vertical, sorry.
Which handler you are using with your GestureOverlayView? OnGesturePerformedListener or OnGestureListener? If you are using OnGesturePerformedListener you will be limited to the orientation of your screen. You should use OnGestureListener and implement the onGestureEnded function of it. It gives you the performed 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
精彩评论