I'm using JetPack navigation component to navigate between fragments. I've added slide animation between 2 fragments in graph xml:
<action
android:id="@+id/action_Fragment_to_DetailsFragment"
app:enterAnim="@anim/slide_left"
app:popEnterAnim="@anim/slide_right"
app:destination="@id/DetailsFragment" />
The problem is - b/c I'm using navigation component and it uses fragmentManager.replace()
, instead of fragmentManager.add()
, instead of smooth animation I see that:
the first fragment disappears
animation of 2nd fragment is being triggered and sliding new fragment to a screen
2nd fragment appears on a screen.
And b/c I have different content on both screens, it looks buggy.
I want to implement is "like in IOS" where user sees 2 layers of screens, sliding from each other. Is there a way to implement it with Navigation component which doesn't support "fragmentManager.add()
"?
I've also tried
app:enterAnim="@anim/slide_in_right"
app:exitAnim="@anim/slide_out_left"
app:popEnterAnim="@anim/slide_in_left"
app:popExitAnim="@anim/slide_out_right"
but situation is not much better.