There are two master / details snippets. I want to animate the transition from one fragment to another. For example, after clicking on the cabins button, the Next fragment should move to its place (move to the left), and another fragment appeared instead. In simple terms, you need to swap the fragments using animation.

Markup:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <FrameLayout android:id="@+id/master_container" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" /> <FrameLayout android:id="@+id/detail_container" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="2" /> </LinearLayout> 

Code:

  manager.beginTransaction() .remove(masterFragment) .setCustomAnimations(android.R.anim.slide_out_right, android.R.anim.slide_in_left) .commit(); manager.executePendingTransactions(); manager.beginTransaction() .replace(MASTER_CONTAINER, masterFragment) .setCustomAnimations(android.R.anim.slide_in_left, android.R.anim.slide_out_right) .commit(); manager.executePendingTransactions(); 

Fragments

    0