Thursday, 3 January 2019

Modal animation with jetpack navigation transition

How can you create modal transition animation?

I'm using the jetpack navigation graph where you can bind transition animations. But the default behaviour looks really weird. Let me explain why.

If you bind an enter animation without an exit animation. Your exit fragment will disappear at the start of the animation. Which doesn't look really nice.

So i decided to create an exit animation with the same duration of the enter animation, which does nothing. But now the enter fragment will slide on top of the exit fragment but underneath the toolbar of the exit fragment (each fragment contains a toolbar).

Is there a way to create a good looking modal animation for a jetpack transition?

This is my slide up animation..

<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/decelerate_interpolator"
android:fillAfter="true">
<translate
    android:duration="@android:integer/config_mediumAnimTime"
    android:fromYDelta="100%"
    android:toYDelta="0%">
</translate>
</set>



from Modal animation with jetpack navigation transition

No comments:

Post a Comment