0

I am trying to implement the below fragment transition using navigation architecture component. This animation works perfectly when the fragment is launched with fragment manager. But with navigation architecture component, the fragment A disappears when fragment B is entering. I used a fake animation that does nothing on fragment A, but it still does not help. Any ideas how I can fix it?

enter image description here

Here is my code in nav_graph.xml

<fragment
    android:id="@+id/fragmentA"
    android:name="xxxx.FragmentA"
    android:label="FragmentA"
    tools:layout="@layout/fragment_a" >
    <action
        android:id="@+id/action_fragmentA_to_fragmentB"
        app:destination="@id/fragmentB"
        app:enterAnim="@anim/slide_in_from_bottom"
        app:exitAnim="@anim/fake_anim" />
</fragment>

slide_in_from_bottom.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@android:anim/accelerate_decelerate_interpolator"
    android:shareInterpolator="true">
    <translate android:duration="250" android:fromYDelta="100%" android:toYDelta="0%" />
</set>

fake_anim.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <alpha
        android:fromAlpha="1.0"
        android:toAlpha="1.0"
        android:duration="250" />
</set>
Raquib-ul Alam
  • 574
  • 1
  • 6
  • 17

1 Answers1

1

Looks like this is a bug in the jetpack library. Will have to wait until they fix this: https://issuetracker.google.com/issues/118843009

Raquib-ul Alam
  • 574
  • 1
  • 6
  • 17