Java – FragmentTransaction animation – Displays the entry fragment above the exit fragment

FragmentTransaction animation – Displays the entry fragment above the exit fragment… here is a solution to the problem.

FragmentTransaction animation – Displays the entry fragment above the exit fragment

When you use the checked animation shift fragment (the duration of the outgoing fragment is longer than the duration of the animated occurrence fragment), you are faced with the fact that the animation falls below the outgoing fragment when the fragment appears – I want it to animate on the outgoing fragment. Who knows how to achieve the desired results?

The first fragment adds:

fragmentManager.beginTransaction().add(R.id.frame_layout_fragments_container, new FragmentHome(), "home").commit();

Replace fragment :

fragmentManager.beginTransaction().setCustomAnimations(R.anim.forward_show, R.anim.forward_hide, R.anim.back_show, R.anim.back_hide).replace(R.id.frame_layout_ fragments_container, fragment, fragmentName).commit();

Simple illustration

Now I have:
enter image description here

What I need:
enter image description here

Solution

Related Problems and Solutions