title: Slide left/right animation between fragments
body: <p>I post a question here because I can't find out a solution to my problem. I read a lot of things about android animation.</p>
  
  <p>I actually develop an android 4.0 app and I need to animate transition between fragments (not layout).</p>
  
  <p><a href="https://stackoverflow.com/questions/4932462/animate-the-transition-between-fragments">Similary post, worked with layout but no more precision about fragments</a></p>
  
  <p>Here my uncomplete code :</p>
  
  <p><strong>Activity code</strong></p>
  
  <pre><code>private void showFragment(final Fragment fragment)
  {
      if (null == fragment)
          return;
  
      FragmentTransaction ft = getFragmentManager().beginTransaction();
  
      ft.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_right);
  
      ft.replace(R.id.fragment_container_layout, fragment, fragment.getClass().getSimpleName()).commit();
  
  }
  </code></pre>
  
  <p><strong>R.anim.slide_in_left</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;set xmlns:android="http://schemas.android.com/apk/res/android" 
      android:duration="@android:integer/config_mediumAnimTime"&gt;
  
      &lt;translate
          android:fromXDelta="100%p"
          android:toXDelta="0" /&gt;
  
      &lt;alpha
          android:fromAlpha="0.0"
          android:toAlpha="1.0" /&gt;
  
  &lt;/set&gt;
  </code></pre>
  
  <p>And finally <strong>R.anim.slide_out_right</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;set xmlns:android="http://schemas.android.com/apk/res/android"
      android:duration="@android:integer/config_mediumAnimTime" &gt;
  
      &lt;translate
          android:fromXDelta="0"
          android:toXDelta="-100%p" /&gt;
  
      &lt;alpha
          android:fromAlpha="1.0"
          android:toAlpha="0.0" /&gt;
  
  &lt;/set&gt;
  </code></pre>
  
  <p>When I run this code, I got an exception : 
  <strong>12-27 15:26:55.566: E/AndroidRuntime(27699): java.lang.RuntimeException: Unknown animator name: translate</strong></p>
  
  <p>Do you have any idea to fix this ?</p>