Jetpack Navigation: Getting Started

Aug 10 2021 · Kotlin 1.4, Android 11, Android Studio 4.2.1

Part 3: Add Animations & Deep Links

08. Animate Transitions Between Destinations

Episode complete

Play next episode

Next
About this episode
Leave a rating/review
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 07. Pass Data Between Destinations Next episode: 09. Global Actions

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Transcript: 08. Animate Transitions Between Destinations

Navigation component lets you add both property and view animations to actions. Adding Animations to Actions looks good from User Experience perspective. Navigation includes several default animations to get you started.

Also, In the starter project, there are xml files included for Slide In and Out animations. Click on res and expand anim folder.

These animation files include Translation animation. Since the animation is in horizontal direction, you tweak in values of fromXDelta and toXDeltaonly .

The other two parameters fromYDeltaand toYDelta remain 0% only and need not be specified. Now open your navigation graph.

Switch to Design View, select actionWelcomeFromLogin. Under Animations in Attributes section, there are four types.

enterAnim is the animation you get while Entering a Destination. exitAnimis the animation you get while Exiting a Destination.

popEnterAnim is the animation you get while Entering a Destination via a pop action. popExitAnim the animation you get while Exiting a Destination via a pop action.

Select slide_in_right for enterAnim. Select slide_out_left for exitAnim.

Select slide_in_left for popEnterAnim. Select slide_out_right for popExitAnim.

Switch to code view and confirm the Animation added for actionWelcomeFromLogin

Build and run the app.

Click Log In button. Enter detail and Login. Click Go to Welcome to see the animation in action. Awesome, and very easy . Isn’t it?