title: Android : How to slide up a fragment?
body: <p>I am trying to add animation to a fragment appearing on button click, from bottom.</p>
  
  <p>Fragment Layout</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_alignParentBottom="true"
      android:orientation="vertical" &gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="50dp"
          android:background="@color/wallet_holo_blue_light"
          android:layout_gravity="center"
          android:text="This is a fragmentt layout"
          android:layout_alignParentBottom="true"
          android:layout_centerHorizontal="true" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Slide up.xml</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 xmlns:android="http://schemas.android.com/apk/res/android"
          android:duration="@android:integer/config_mediumAnimTime"
          android:fromYDelta="50.0%p"
          android:interpolator="@android:anim/decelerate_interpolator"
          android:toYDelta="30" /&gt;
  &lt;/set&gt;
  </code></pre>
  
  <p>Calling it here:</p>
  
  <pre><code>public void onClick(View view) {
  
             if(view == button ){
  
          FragmentManager fragmentManager = getFragmentManager();
          FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
          FragmentOnMap hello = new FragmentOnMap();
  
          fragmentTransaction.add(R.id.fragment_container, hello, "HELLO");
          fragmentTransaction.setCustomAnimations(R.animator.slide_up,0);
          fragmentTransaction.commit();
      }
  
  
  }
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/4817900/android-fragments-and-animation">Android Fragments and animation</a> shows how to slide up AND down, I just the fragment to animate up. Hence my question, of the second argument of setcustomanimation() function</p>
  
  <p>I tried using <code>fragmentTransaction.setCustomAnimations()</code> just before commit, but didn't help. </p>
  
  <p>It does appear at the bottom, but there is no transition effect.
  Any guidance would be useful.
  Thank you</p>