title: Android animate drop down/up view proper
body: <p>I'm trying to do a proper slide-down animation. The view that slides down should push all views below it down in one smooth movement and again when it slides up all the views should follow in one smooth movement.</p>
  <p><strong>What I've tried</strong>:</p>
  <p>In code:</p>
  <pre><code>LinearLayout lin = (LinearLayout)findViewById(R.id.user_list_container);
                  setLayoutAnimSlidedownfromtop(lin, this);
                  lin.addView(getLayoutInflater().inflate(R.layout.user_panel,null),0);
  </code></pre>
  <p>And:</p>
  <pre><code>public static void setLayoutAnimSlidedownfromtop(ViewGroup panel, Context ctx) {
  
        AnimationSet set = new AnimationSet(true);
  
        Animation animation = new AlphaAnimation(0.0f, 1.0f);
        animation.setDuration(100);
        set.addAnimation(animation);
  
        animation = new TranslateAnimation(
            Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
            Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f
        );
        animation.setDuration(500);
        set.addAnimation(animation);
  
        LayoutAnimationController controller =
            new LayoutAnimationController(set, 0.25f);
        panel.setLayoutAnimation(controller);
  
  }
  </code></pre>
  <p>My <code>user_panel.xml</code>:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;40dp&quot;
      android:orientation=&quot;vertical&quot; &gt;
      &lt;ImageView 
          android:layout_alignParentLeft=&quot;true&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_width=&quot;wrap_content&quot;
          android:src=&quot;@drawable/icon&quot; /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  <p>Top of the main XML:</p>
  <pre><code>&lt;LinearLayout
          android:id=&quot;@+id/user_list_container&quot;
          android:layout_alignParentTop=&quot;true&quot;
          android:orientation=&quot;vertical&quot; 
          android:layout_width=&quot;fill_parent&quot;
          android:layout_height=&quot;wrap_content&quot;/&gt;
      &lt;LinearLayout
          android:id=&quot;@+id/container&quot;
          android:layout_below=&quot;@+id/user_list_container&quot;
          android:orientation=&quot;vertical&quot; 
          android:layout_width=&quot;fill_parent&quot;
          android:layout_height=&quot;wrap_content&quot;&gt;
  </code></pre>
  <p>The problem with above approach is that when I start the animation first the empty space for the view is created and then the view slides down. I'd like it to slowly push all the other views down instead of doing it in one hard motion.</p>