Show navigation Hide navigation

Animating Views Using Scenes and Transitions

Dependencies and Prerequisites

  • Android 4.4.2 (API level 19) or higher

You should also read

Try it out

Video

DevBytes: Android 4.4 Transitions

The user interface of an activity often changes in response to user input and other events. For example, an activity that contains a form where users can type search queries can hide the form when the user submits it and show a list of search results in its place.

To provide visual continuity in these situations, you can animate changes between different view hierarchies in your user interface. These animations give users feedback on their actions and help them learn how your app works.

Android includes the transitions framework, which enables you to easily animate changes between two view hierarchies. The framework animates the views at runtime by changing some of their property values over time. The framework includes built-in animations for common effects and lets you create custom animations and transition lifecycle callbacks.

This class teaches you to use the built-in animations in the transitions framework to animate changes between view hierarchies. This class also covers how to create custom animations.

Note: For Android versions earlier than 4.4.2 (API level 19) but greater than or equal to Android 4.0 (API level 14), use the animateLayoutChanges attribute to animate layouts. To learn more, see Property Animation and Animating Layout Changes.

Lessons

The Transitions Framework
Learn the main features and components of the transitions framework.
Creating a Scene
Learn how to create a scene to store the state of a view hierarchy.
Applying a Transition
Learn how to apply a transition between two scenes of a view hierarchy.
Creating Custom Transitions
Learn how to create other animation effects not included in the transitions framework.