Search code examples
androiduser-interfaceanimationviewflipper

Android: When using ViewFlipper, can I start the in animation only after the out animation has ended?


I'm trying to create a 3d flip animation on a viewflipper. By 3d flip I mean the following: think of the current view as the front of a playing card, then turn it around on it's Y axis - this is a very common effect on iPhone and I'm trying to emulate it on android. I have a pretty good implementation of a 3d flip but I need the out animation to only start after the in animation has ended. Is that possible? I didn't really see many options in the android documentation. Thanks, e.


Solution

  • You can add a startOffset to the in animation that matches the duration of the out animation.

    in xml it is

    android:startOffset="milliseconds"
    

    in code

    animation.setStartOffset(milliseconds);
    

    Set the startOffset to the same or greater value than the android:duration setting of the out animation.