title: FragmentTransaction animation to slide in over top
body: <p>I am trying to achieve the following effect using FragmentTransaction.setCustomAnimations.</p>
  
  <ol>
  <li>Fragment A is showing</li>
  <li>Replace Fragment A with Fragment B. Fragment A should remain visible during the replacement.  Fragment B should slide in from the right. Fragment B should slide in OVER THE TOP of Fragment A.</li>
  </ol>
  
  <p>I have no problem getting the slide in animation setup. My problem is that I cannot figure out how to make Fragment A stay where it is and be UNDER Fragment B while the slide in animation is running. No matter what I do it seems that Fragment A is on top.</p>
  
  <p>How can I achieve this?</p>
  
  <p>Here is the FragmentTransaction code:</p>
  
  <pre><code>FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
  ft.setCustomAnimations(R.anim.slide_in_right, R.anim.nothing, R.anim.nothing,
      R.anim.slide_out_right);
  ft.replace(R.id.fragment_content, fragment, name);
  ft.addToBackStack(name);
  ft.commit();
  </code></pre>
  
  <p>As you can see I have defined an animation R.anim.nothing for the "out" animation because I actually don't want Fragment A to do anything other than just stay where it is during the transaction.</p>
  
  <p>Here are the animation resources:</p>
  
  <p>slide_in_right.xml</p>
  
  <pre><code>&lt;translate xmlns:android="http://schemas.android.com/apk/res/android"
      android:duration="@android:integer/config_mediumAnimTime"
      android:fromXDelta="100%p"
      android:toXDelta="0"
      android:zAdjustment="top" /&gt;
  </code></pre>
  
  <p>nothing.xml</p>
  
  <pre><code>&lt;alpha xmlns:android="http://schemas.android.com/apk/res/android"
      android:duration="@android:integer/config_mediumAnimTime"
      android:fromAlpha="1.0"
      android:toAlpha="1.0"
      android:zAdjustment="bottom" /&gt;
  </code></pre>