In previous posts, I showed you how to apply animation (fade, slide) to activity transaction.
In this post, I’ll show you how to do a card flip animation applied for any View or Layout objects.
A - Create the Animator
Firstly, we need to create Animator for the card flip animation.
flight_left_in.xml defines the animation when the front card comes out and the back card comes in from the left.
flight_right_out.xml defines the animation for the front card comes out to the right:
B - Create the View for demo application
In card flip animation demo application, we will create a simple view with 2 ImageView and one Flip button:
The preview UI will be like this:
C - Apply Card Flip Animation
Before apply card flip animation to the ImageView, we need to create some indeed variables:
After that, init them in onCreate method:
Implement the onClickListener for Flip button:
Finally, run the demo application and enjoy the result:
D - Source code Card Flip Animation
Note: I build this project using Android Studio.
http://www.mediafire.com/?j6cq5qqj64806xk
https://docs.google.com/file/d/0Bw3dwdSezn6fMHo0TkN2SXFfQTg/edit?usp=docslist_api