title: Fragment slide animation is replacing first fragment before animating
body: <p>I've followed instructions from dmanargias answer here: <a href="https://stackoverflow.com/questions/4817900/android-fragments-and-animation">Android Fragments and animation</a></p>
  
  <p>The animations themselves work, however the initial animation when adding a fragment is doing something strange.  The initial fragment appears to be replaced with the new fragment before the animation is started.</p>
  
  <p>e.g.  One would expect an animation of 
  A &lt;- B (B sliding from right to cover A)</p>
  
  <p>However as soon as the action starts A instantly becomes B and you get an animation of 
  B &lt;- B.</p>
  
  <p>When popping the stack you get a correct animation of A -> B (B sliding away revealing A)</p>
  
  <p>This is the code that adds a fragment:</p>
  
  <pre><code>CategoryFragment newFragment = CategoryFragment.newInstance();
  
  FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
  fragmentTransaction.setCustomAnimations(R.anim.enter, R.anim.exit, R.anim.pop_enter, R.anim.pop_exit);
  
  fragmentTransaction.replace(R.id.fragment, newFragment);
  fragmentTransaction.addToBackStack(null);
  fragmentTransaction.commit();
  </code></pre>
  
  <p>Any ideas why this would happen and if there's a way to fix it?</p>