title: android swapping two views using animation when click on imagebutton
body: <p>I have seen the questions in the stack over flow, even I tried,</p>
  
  <p><a href="https://stackoverflow.com/questions/23101335/android-translate-animation-like-swapping-two-views">Android Translate Animation like Swapping Two Views</a></p>
  
  <p>But nothing worked for my scenario, I want to swap swap_above linear layout and swap_below linear layouts when click on swap image button. If possible I would like to apply animation for swap imagebutton also, when the views are being swapped.</p>
  
  <p>Thank you, </p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical"&gt;
  
      &lt;FrameLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical"&gt;
  
              &lt;LinearLayout
                  android:id="@+id/from"
                  android:layout_width="match_parent"
                  android:layout_height="0dp"
                  android:layout_weight="1"
                  android:gravity="center_vertical"
                  android:orientation="vertical"
                  android:paddingBottom="25dp"
                  android:paddingLeft="25dp"
                  android:paddingRight="25dp"
                  android:paddingTop="15dp"&gt;
  
                  &lt;TextView
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="From"
                      android:textStyle="bold" /&gt;
  
                  &lt;LinearLayout
                      android:id="@+id/swap_above"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"&gt;
  
                      &lt;LinearLayout
                          android:id="@+id/from_layout"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:layout_marginTop="20dp"
                          android:orientation="horizontal"&gt;
  
                          &lt;TextView
                              android:id="@+id/from_text"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:drawableLeft="@drawable/seek_thumb_pressed"
                              android:drawablePadding="5dp"
                              android:text="BANGALORE"
                              android:textSize="20dp" /&gt;
  
                          &lt;TextView
                              android:id="@+id/from_place"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:gravity="center_vertical"
                              android:text=" (BLR)"
                              android:textSize="15dp" /&gt;
                      &lt;/LinearLayout&gt;
                  &lt;/LinearLayout&gt;
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_gravity="center_vertical"
                  android:gravity="center_vertical"
                  android:orientation="horizontal"&gt;
  
                  &lt;View
                      android:layout_width="0dp"
                      android:layout_height="0.5dp"
                      android:layout_marginLeft="20dp"
                      android:layout_weight="1"
                      android:background="#FFF" /&gt;
  
                  &lt;View
                      android:layout_width="60dp"
                      android:layout_height="0dp" /&gt;
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:id="@+id/to"
                  android:layout_width="match_parent"
                  android:layout_height="0dp"
                  android:layout_weight="1"
                  android:gravity="center_vertical"
                  android:orientation="vertical"
                  android:paddingBottom="25dp"
                  android:paddingLeft="25dp"
                  android:paddingRight="25dp"
                  android:paddingTop="15dp"&gt;
  
                  &lt;TextView
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="To"
                      android:textStyle="bold" /&gt;
  
                  &lt;LinearLayout
                      android:id="@+id/swap_below"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"&gt;
  
                      &lt;LinearLayout
                          android:id="@+id/to_layout"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:layout_marginTop="20dp"
                          android:orientation="horizontal"&gt;
  
                          &lt;TextView
                              android:id="@+id/to_text"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:drawableLeft="@drawable/seek_thumb_normal"
                              android:drawablePadding="5dp"
                              android:text="Hyderabad"
                              android:textSize="20dp" /&gt;
  
                          &lt;TextView
                              android:id="@+id/to_place"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:gravity="center_vertical"
                              android:text=" (HYD)"
                              android:textSize="15dp" /&gt;
                      &lt;/LinearLayout&gt;
                  &lt;/LinearLayout&gt;
              &lt;/LinearLayout&gt;
          &lt;/LinearLayout&gt;
  
          &lt;ImageButton
              android:id="@+id/swap"
              android:layout_width="60dp"
              android:layout_height="60dp"
              android:layout_gravity="center_vertical|end"
              android:background="?android:attr/selectableItemBackground"
              android:src="@drawable/seek_thumb_disabled" /&gt;
      &lt;/FrameLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>