title: Android animation - how add start margin?
body: <p>I am trying to make animation of group of buttons sliding in and out but I am struggling with one problem.
  Current animation is moving correctly but is sliding out from the very left of the screen. Just where is the button used to show up this. So this makes whole animation looks bad, because this group is sliding on this.</p>
  
  <p>What I want to achieve is add some margin, or something similar that will make start of the animation just from the point where is the button.</p>
  
  <p>I want it to look like this:</p>
  
  <p><img src="https://i.stack.imgur.com/JRrLI.png" alt="margin"></p>
  
  <p>That means those 3 images will start showing from this white line, not from the very left of the screen.</p>
  
  <p>Main activity <code>onCreate</code>, where everything is going on:</p>
  
  <pre><code> @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
          image1 = (LinearLayout)findViewById(R.id.imageLayout);
          button = (Button)findViewById(R.id.buttonShow);
  
          animationSlideInLeft = AnimationUtils.loadAnimation(this, 
                  R.anim.push_right_in);
          animationSlideOutRight = AnimationUtils.loadAnimation(this, 
                  R.anim.push_left_out);
          animationSlideInLeft.setDuration(1000);
          animationSlideOutRight.setDuration(1000);
          animationSlideInLeft.setAnimationListener(animationSlideInLeftListener);
          animationSlideOutRight.setAnimationListener(animationSlideOutRightListener);
  
          button.setOnClickListener(new OnClickListener() {
  
              @Override
              public void onClick(View v)
              {
                  if(v == button)
                  {
                      if(!on)
                      {
                          curSlidingImage = image1;
                          image1.startAnimation(animationSlideInLeft);
                          image1.setVisibility(View.VISIBLE);
                          on = true;
                      }
                      else
                      {
                          image1.startAnimation(animationSlideOutRight);
                          image1.setVisibility(View.INVISIBLE);
                          on = false;
                      }
                  }
              }
          });
  
      }
  </code></pre>
  
  <p>animations files:</p>
  
  <p><strong>push_right_in</strong></p>
  
  <pre><code>&lt;set xmlns:android="http://schemas.android.com/apk/res/android" &gt;
  
      &lt;translate
          android:duration="300"
          android:fromXDelta="-100%p"
          android:toXDelta="0" /&gt;
  
      &lt;alpha
          android:duration="300"
          android:fromAlpha="0.0"
          android:toAlpha="1.0" /&gt;
  
  &lt;/set&gt;
  </code></pre>
  
  <p><strong>push_left_out</strong></p>
  
  <pre><code>&lt;set xmlns:android="http://schemas.android.com/apk/res/android" &gt;
  
      &lt;translate
          android:duration="300"
          android:fromXDelta="0"
          android:toXDelta="-100%p" /&gt;
  
      &lt;alpha
          android:duration="300"
          android:fromAlpha="1.0"
          android:toAlpha="0.0" /&gt;
  
  &lt;/set&gt;
  </code></pre>
  
  <p><strong>main.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent" &gt;
  
      &lt;Button
          android:id="@+id/buttonShow"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Btn" /&gt;
  
      &lt;LinearLayout
          android:id="@+id/imageLayout"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:visibility="invisible" &gt;
  
          &lt;ImageView
              android:id="@+id/image1"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:src="@drawable/icon" /&gt;
  
          &lt;ImageView
              android:id="@+id/image2"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:src="@drawable/icon" /&gt;
  
          &lt;ImageView
              android:id="@+id/image3"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:src="@drawable/icon" /&gt;
      &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>