Custom Animations with ObjectAnimator

Earlier, we exposed you to a little custom animations on fragments. You used a custom animation to fade out the current details fragment while you faded in the new details fragment. We also told you that the stock animations under the Android SDK were few, and some don’t even work. This section will help you understand how to create your own custom animations so you can do interesting transitions between old fragments and new fragments.

The mechanism for implementing custom animations on fragments is the ObjectAnimator class. This is actually a generic feature in Android that can be applied to View objects and not just fragments. You’re only going to worry about fragments in this section, but the principles ...

Get Pro Android 4 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.