title: How can I evenly space my ImageViews in a RelativeLayout
body: <p>I had a Android application built in which I had 3 <code>ImageView</code>s placed horizontally across a <code>LinearLayout</code>, they were placed with a <code>android:layout_width="0dp"</code> and <code>android:layout_weight="1"</code> such that they had an even spread in the layout. </p>
  
  <p>Now I have to switch to use a <code>RelativeLayout</code> (because I want to overlap another image and that can't be done with a <code>LinearLayout</code>) so I want to start with replicating the same effect of having the 3 <code>ImageView</code>s evenly spread/scaled across the parent layout, but I'm not sure how to achieve this.</p>
  
  <p>I feel like I need to make use of the <a href="http://developer.android.com/reference/android/widget/ImageView.ScaleType.html" rel="nofollow noreferrer"><code>android:scaleType</code></a>... maybe center crop:</p>
  
  <blockquote>
    <p>Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equal to or larger than the corresponding dimension of the view (minus padding). </p>
  </blockquote>
  
  <p>Which sounds good but I can't seem to get it to work right... <em>Any thoughts on how I would achieve this even spread of <code>ImageView</code>s across my <code>RelativeLayout</code></em>?</p>
  
  <p>Snippet of code right now:</p>
  
  <pre><code>&lt;RelativeLayout
     android:layout_width="fill_parent"
     android:layout_height="0dp"
     android:layout_weight="1"
     android:orientation="horizontal" &gt;
     &lt;ImageView
         android:id="@+id/dragcircle"
         android:layout_width="wrap_content"
         android:tag="circle"
         android:layout_alignParentLeft="true"
         android:layout_height="wrap_content"
         android:adjustViewBounds="false"
         android:scaleType="centerCrop"
         android:src="@drawable/circle" /&gt;
      &lt;ImageView
         android:id="@+id/dragsquare"
         android:layout_width="wrap_content"
         android:tag="square"
         android:layout_height="wrap_content"
         android:layout_toRightOf="@id/dragcircle"
         android:adjustViewBounds="false"
         android:src="@drawable/square" /&gt;
      &lt;ImageView
         android:id="@+id/dragtriangle"
         android:layout_width="wrap_content"
         android:tag="triangle"
         android:layout_height="wrap_content"
         android:layout_toRightOf="@id/dragsquare"
         android:adjustViewBounds="false"
         android:src="@drawable/triangle" /&gt;
  </code></pre>
  
  <p></p>
  
  <hr>
  
  <p>Note: I can't find a question with the same constraints as this one on SO. There are a number of questions like:</p>
  
  <p><a href="https://stackoverflow.com/questions/4338792/android-how-evenly-space-components-within-relativelayout">Android: how evenly space components within RelativeLayout?</a>
  and
  <a href="https://stackoverflow.com/questions/5765170/android-relativelayout-equal-spacing">android RelativeLayout, equal spacing?</a></p>
  
  <p>But if you check out the details you'll see that they are people who have not considered the <code>LinearLayout</code> as an option for equal spacing and switching layout types ends up being the solution. I have, I was using it, but it <strong>does not</strong> work for me because I need to overlap an image:</p>
  
  <p>Note the example, I have 3 <code>ImageView</code>s with basic shapes, but I also have a 4<sup>th</sup> <code>ImageView</code> (it starts hidden) which is overlapping the middle one. This is why I must use a <code>RelativeLayout</code></p>
  
  <p><img src="https://i.stack.imgur.com/LO8lz.jpg" alt="enter image description here"></p>