Creating a Card Flip Animation with Fragments

The card flip is a common animation that we will demonstrate using fragment transitions. We'll use two different images—one for the front and one for the back, to create the card flip effect. We'll need four animation resources: two for the front and two for the back transitions, which we will define in XML using objectAnimator.

Here's a screenshot of the application we'll build showing the Card Flip Animation in action:

Creating a Card Flip Animation with Fragments

Getting ready

Create a new project in Android Studio and call it: CardFlip. Use the default Phone & Tablet options and select Empty Activity when prompted for the Activity Type.

For the ...

Get Android Application Development Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.