title: Sliding UP and DOWN Animation for my Layout
body: <p>I have 2 LinearLayouts which splits the screen into two, Top and Bottom (Refer the screenshot). when the user press the the  FloatingActionButton ,the first LinearLayout should slides upwards and the second LinearLayout should slide downwards, here is my try, but its not working  ,  <a href="https://i.stack.imgur.com/YzVOS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YzVOS.png" alt="see my concept"></a></p>
  
  <p>this is my xml file</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  app:layout_behavior="@string/appbar_scrolling_view_behavior"
  tools:showIn="@layout/activity_main"
  tools:context="com.example.jaisonjoseph.sample.MainActivity"
  android:orientation="vertical"&gt;
  
  
  &lt;LinearLayout
      android:id="@+id/first"
      android:layout_width="fill_parent"
      android:layout_height="match_parent"
      android:layout_gravity="top"
      android:layout_weight=".1"
      android:background="@android:color/holo_blue_dark"
      android:orientation="horizontal"&gt;
  
  
  &lt;/LinearLayout&gt;
  
  &lt;LinearLayout
      android:id="@+id/second"
      android:layout_width="fill_parent"
      android:layout_height="match_parent"
      android:layout_gravity="bottom"
      android:layout_weight=".1"
      android:background="@android:color/holo_green_light"
      android:orientation="horizontal" /&gt;
  
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>these are the 2 xml files for animation</p>
  
  <p>first one</p>
  
  <pre><code>  &lt;?xml version="1.0" encoding="utf-8"?&gt;
   &lt;set xmlns:android="http://schemas.android.com/apk/res/android" &gt;
  
      &lt;translate
      android:duration="1000"
      android:fromYDelta="0"
      android:toYDelta="100%" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>second </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;set xmlns:android="http://schemas.android.com/apk/res/android" &gt;
  
  &lt;translate
      android:duration="1000"
      android:fromYDelta="100%"
      android:toYDelta="0" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>here is the code for main activity</p>
  
  <pre><code>   final LinearLayout first =(LinearLayout)findViewById(R.id.first) ;
      final LinearLayout second =(LinearLayout)findViewById(R.id.second) ;
  
      final Animation slide_down = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_down);
      final Animation slide_up = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_up);
  
     FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
      fab.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
  
  
  
  
  
             first.setAnimation(slide_up);
             second.setAnimation(slide_down);
  
          }
      });
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/EGWcK.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EGWcK.gif" alt="after adding the answer"></a>    </p>