SetCustomAnimations is always replaced at the top to exit the fragment

I have this code:

FragmentTransaction transaction = manager.beginTransaction();

            stopMain = new OTDMainStopsFragment();
            transaction.setCustomAnimations(R.anim.right_left_anim_x_left,R.anim.fragment_scale_out, R.anim.fragment_scale_in, R.anim.left_right_anim_x_right);
            transaction.replace(R.id.main_fragment_container, stopMain).addToBackStack("OTDMainStopsFragment");
            transaction.commit();

      

What I'm going to achieve is to have the inbound fragment on top of the outbound fragment (the add method won't do because I need to animate the output and the inbound of the fragments when it pops out of the backstack).

What really happens is that when you change the fragment, the outgoing fragment will animate over the incoming fragment.

How do I change the z index for the outgoing chunk that is below the incoming chunk.

Refined BTW snippet animations work as if it were

+3


source to share





All Articles