Adding and using animations with the Navigation component

For a new animation, create a new resource file in the res/anim folder:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <alpha
        android:duration="@android:integer/config_mediumAnimTime" // Sets the duration of the animation
        android:fromAlpha="0.0" // Begins fully transparent
        android:toAlpha="1.0" // And ends in fully opaque
        />
</set>

Another example:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate
        android:duration="@android:integer/config_shortAnimTime"
        android:fromXDelta="-100%" // Begins fully offscreen left
        android:fromYDelta="0%" // No change in vertical positioning
        android:toXDelta="0%" // Ends centred (no offest)
        android:toYDelta="0%" />
</set>

Apply your animations by clicking on the link between Fragments in the Design view and choosing in the Animations section.