title: Custom View and Layout Animation android
body: <p>I have a layout which at start has '0dp' width but when a button is clicked it animates from Left to right and its width is increased accordingly. In this layout I am initializing a custom view. The view is initialized correctly when I place it at right or at centre but when I place it on the left it's not shown. </p>
  
  <p>Here is my XML:</p>
  
  <pre><code>&lt;RelativeLayout
      android:layout_width="0dp"
      android:layout_height="match_parent"
      android:layout_weight="0"
      android:background="@drawable/bg"&gt;
      &lt;com.example.Wheel
          android:id="@+id/wheel"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentLeft="true"
          android:layout_centerVertical="true" &gt;
      &lt;/com.example.Wheel&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>And here is what I do in java:</p>
  
  <pre><code>MenuListLeft = (RelativeLayout) findViewById(R.id.ControlLayout);
  openButton.setOnClickListener(new OnClickListener() {
      public void onClick(View v) {
          if (isExpandedLeft) {
              isExpandedLeft = false;
              MenuListLeft.startAnimation(new CollapseAnimationLTR(MenuListLeft, 0,(int)(screenWidth*1), 5));
          }
          else {
              isExpandedLeft = true;
              MenuListLeft.startAnimation(new ExpandAnimationLTR(MenuListLeft, 0,(int)(screenWidth*1), 5));
              init();
          }
      }
  });
  </code></pre>