1

I have a bottomNavigationView that I set up with a nav controller.

The nav Host graph is a navigation graph with 2 nested graphs.

When I navigate between the nested graphs, there is a fragment which is then shown (The fragment which was at the top of the stack of the nested Graph)

The problem id that the fragment is shown with the animation thet was used to navigate to it INSIDE THE NESTED GRAPH.

This is the code for the parent graph:

<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/home_nav"
    app:startDestination="@id/home_main_nav">

    <navigation
        android:id="@+id/home_main_nav"
        app:startDestination="@id/main_nav">
        <include app:graph="@navigation/main_nav" />
    </navigation>
    <navigation
        android:id="@+id/home_notifications_nav"
        app:startDestination="@id/notifications_nav">
        <include app:graph="@navigation/notifications_nav" />
    </navigation>

</navigation>

And this is the code for the nested graph

<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/main_nav"
    app:startDestination="@id/mainFragment">

    <fragment
        android:id="@+id/mainFragment"
        android:name="com.scorelate.app.fragments.home.MainFragment"
        android:label="fragment_home_main"
        tools:layout="@layout/fragment_home_main">
        <action
            android:id="@+id/action_mainFragment_to_paymentsFragment"
            app:destination="@id/paymentsFragment"
            app:enterAnim="@anim/slide_in_right"
            app:exitAnim="@anim/do_nothing"
            app:popExitAnim="@anim/slide_out_right" />
       
    </fragment>
    <fragment
        android:id="@+id/paymentsFragment"
        android:name="com.scorelate.app.fragments.home.PaymentsFragment"
        android:label="fragment_payments"
        tools:layout="@layout/fragment_payments" />
   
</navigation>

When the payments fragment is in the main nav, and I navigate to it from the notifications nav, the animation used for it is @anim/slide_in_right

But when the mainFragment (start destination) is in the main nav, the animation used is just a fade animation.

How can I make that the animation for the payments fragment too?

Gal Arzi
  • 41
  • 1
  • 1

0 Answers0