title: Android: Correctly position buttons inside layout
body: <p>I have a following layout :</p>
  <p><img src="https://i.stack.imgur.com/bJ27o.png" alt="enter image description here" /></p>
  <pre><code>&lt;LinearLayout //container, should adjust height based on CONTENT view height
          android:orientation=&quot;horizontal&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:baselineAligned=&quot;false&quot;
          android:clickable=&quot;false&quot;
          android:padding=&quot;20dp&quot;&gt;
       &lt;RelativeLayout //this is the CONTENT view height
              android:layout_width=&quot;0dp&quot;
              android:layout_height=&quot;fill_parent&quot;
              android:layout_weight=&quot;5&quot;&gt;....&lt;/RelativeLayout&gt;
  ...
      &lt;RelativeLayout //this is the button layout
              android:layout_width=&quot;0dp&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_weight=&quot;2&quot;&gt;
  
            &lt;Button android:layout_width=&quot;40sp&quot; android:layout_height=&quot;40sp&quot;/&gt;
            &lt;Button android:layout_width=&quot;40sp&quot; android:layout_height=&quot;40sp&quot;/&gt;
      &lt;/RelativeLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  <p>I want the height of the container (<code>LinearLayout</code>) to be adjusted to contain all the views in the <code>RelativeLayout</code> (shown on the left, let's call it <strong>CONTAINER</strong>).</p>
  <p>Then, there are two buttons in the <code>RelativeLayout</code> (shown on the right). I need to align them on top and bottom borders of <code>RelativeLayot</code>, correspondingly. What's really important, is that the height of the buttons' container should be the same (should correspond) to the height of the <strong>CONTAINER</strong>.</p>
  <p>The problem is, if I try to use <code>android:layout_alignParentBottom=&quot;true&quot;</code> and <code>android:layout_alignParentTop=&quot;true&quot;</code> attributes for the buttons, they will stretch the container height, and it will take the whole screen height.</p>
  <p>So, what magic should I use to do the trick? :)</p>