title: Android translation animation for hiding views without changing visiblility
body: <p>I need help with Animation. (My views are more sophisticated and i show you only main elements of my layout xml)</p>
  
  <pre><code>&lt;RelativeLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_alignParentTop="true" &gt;
  
          &lt;LinearLayout
              android:id="@+id/oneBigView"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_centerVertical="true"
              android:gravity="center_vertical"
              android:orientation="vertical"&gt;
  
  
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:id="@+id/fourSmallViews"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_centerVertical="true"
              android:gravity="center_vertical"
              android:orientation="vertical" &gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:weightSum="2" &gt;
  
                  &lt;RelativeLayout
                      android:id="@+id/topLeft"
                      android:layout_width="0dp"
                      android:layout_height="match_parent"
                      android:layout_weight="1" &gt;                       
                  &lt;/RelativeLayout&gt;
  
                  &lt;RelativeLayout
                      android:id="@+id/topRight"
                      android:layout_width="0dp"
                      android:layout_height="match_parent"
                      android:layout_weight="1"&gt;
                  &lt;/RelativeLayout&gt;
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:visibility="invisible"
                  android:weightSum="2" &gt;
  
                  &lt;RelativeLayout
                      android:id="@+id/bottomLeft"
                      android:layout_width="0dp"
                      android:layout_height="match_parent"
                      android:layout_weight="1" &gt;
  
  
                  &lt;/RelativeLayout&gt;
  
                  &lt;RelativeLayout
                      android:id="@+id/bottomRight"
                      android:layout_width="0dp"
                      android:layout_height="match_parent"
                      android:layout_weight="1" &gt;
  
  
                  &lt;/RelativeLayout&gt;
              &lt;/LinearLayout&gt;
          &lt;/LinearLayout&gt;
      &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>I want to show and hide some views:</p>
  
  <ol>
  <li>There is no view visible  </li>
  <li>topLeft and topRight move out from the edges(topLeft from left, topRight from right) to the center of screen(parent).</li>
  <li>When topLeft and topRight achieve half of their move bottomLeft and bottomRight shows exactly the same as topLeft and topRight in prev step</li>
  <li>All four Views stays visible for few seconds.</li>
  <li>topLeft and topRight move out from center of screen(parent)to the edges(topLeft to left, topRight to right).</li>
  <li>When topLeft and topRight achieve half of their move bottomLeft and bottomRight move out exactly the same as topLeft and topRight in prev step</li>
  <li>When all the views disappear oneBigView move from left edge and fills the screen.</li>
  <li>oneBigView stays for few seconds.</li>
  <li>oneBigView move from center to left edge of screen.</li>
  <li>When oneBigView disappear everything starts over from 1.</li>
  </ol>
  
  <p><img src="https://i.stack.imgur.com/NO9Ei.gif" alt="animation overview"></p>
  
  <p>I tried do this but always something was not right:</p>
  
  <ol>
  <li>I tried add some translate animations and changing the Visiblity(I tried View.INVISIBLE and VIEW.GONE) onAnimationEnd: </li>
  </ol>
  
  <p>show</p>
  
  <pre><code>    &lt;set xmlns:android="http://schemas.android.com/apk/res/android"
      android:interpolator="@android:anim/decelerate_interpolator"&gt;
      &lt;translate 
      android:fromXDelta="-100%p" 
      android:toXDelta="0"
      android:duration="500" /&gt;
      &lt;/set&gt;
  </code></pre>
  
  <p>hide</p>
  
  <pre><code>    &lt;set xmlns:android="http://schemas.android.com/apk/res/android"
      android:interpolator="@android:anim/decelerate_interpolator"&gt;
          &lt;translate 
          android:fromXDelta="0"
          android:toXDelta="-100%p"
          android:duration="500" /&gt;
  
      &lt;/set&gt;
  </code></pre>
  
  <p>.java</p>
  
  <pre><code>final Animation leftIn=AnimationUtils.loadAnimation(this, R.anim.show);
  final Animation leftOut=AnimationUtils.loadAnimation(this, R.anim.hide);
  leftIn.setAnimationListener(new Animation.AnimationListener() {
  
          @Override
          public void onAnimationStart(Animation animation) {
              // TODO Auto-generated method stub
  
              //start animation for showing topRight bottomLeft and bottomRight 
              //with propper startOffset
          }
  
          @Override
          public void onAnimationRepeat(Animation animation) {
              // TODO Auto-generated method stub
  
          }
  
          @Override
          public void onAnimationEnd(Animation animation) {
              // TODO Auto-generated method stub
              left1.setVisibility(View.VISIBLE);
              leftOut.setStartOffset(4000);
              left1.startAnimation(leftOut);
  
          }
      });
  leftOut.setAnimationListener(new Animation.AnimationListener() {
  
          @Override
          public void onAnimationStart(Animation animation) {
              // TODO Auto-generated method stub
  
          }
  
          @Override
          public void onAnimationRepeat(Animation animation) {
              // TODO Auto-generated method stub
  
          }
  
          @Override
          public void onAnimationEnd(Animation animation) {
              // TODO Auto-generated method stub
  
              left1.setVisibility(View.INVISIBLE);
          }
      });
  </code></pre>
  
  <p>and so on... It worked perfectly for visibility but animation was not smooth at all (most of the time it works like i haven't use animation). When I stopped changing visiblity animation works correctly but it doesn't do the job. </p>
  
  <p>Any ideas?</p>