title: Android RelativeLayout alignCenter from another View
body: <p>I have a <code>RelativeLayout</code> with two children that are also both <code>RelativeLayout</code>s containing a few buttons and things. These children layouts are not centered in my main layout, and the main layout does contain some other things off the the sides of these two. I want the first one to be on top of the second one. That is easy enough, just use <code>android:layout_below="@+id/firstLayout"</code> in the second one. But I also want the second one to be aligned on the center of the first one. By that I mean I want the second layout to find the center of the first one, and align itself so that its center is in the same x position. I see <code>alignLeft, alignRight, alignTop, and alignBaseline</code>, but no center. Is this possible to do without having to hard code a margin to scoot the second layout over some?</p>
  
  <p>Here is a rough example of what I am trying to end up with, the blue bar would be the first layout, and the red box would be the second layout. I know that I could wrap them both in another <code>RelativeLayout</code> that has sizes equal to <code>"wrap_content"</code> and then use <code>centerHorizontal="true"</code> for the second one. But I would really rather leave both as children of my main layout (I would have to make some changes to the way certain parts of my app work if I make them children of a separate layout. Which I am trying to avoid.)</p>
  
  <p><img src="https://i.stack.imgur.com/X0AxQ.png" alt="Example of what I want"></p>