title: What's a reasonable way to make this layout?
body: <p>In the image below, the yellow square represents a RelativeLayout that's within my overall layout.</p>
  
  <p>The top row "status message" is a ViewFlipper that responds to the ToggleButtons (A, B) that the user can press.  Buttons C, D, and E do other stuff that reload the entire view.  Our client is requesting that buttons A, B, C, D, and E be arranged as in the fashion below.  (Vertical alignment isn't as important as horizontal alignment.)</p>
  
  <p>EDIT to say A, B, C, D, and E are images about 20x20 dip; they are being aligned within a width of about 300dip.  I want the buttons to maintain their aspect ratio. </p>
  
  <p><img src="https://i.stack.imgur.com/mjga6.png" alt="looking to make this layout"></p>
  
  <p>I've created an extension of LinearLayout that inflates buttons A and B (from an xml file), and then another LinearLayout that inflates buttons C, D, and E in another xml file.</p>
  
  <p>Buttons A and B (are actually ToggleButtons):</p>
  
  <pre><code>&lt;RelativeLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:baselineAligned="true"
  &gt;
      &lt;LinearLayout
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerHorizontal="true"
      &gt;
          &lt;ToggleButton
              android:id="@+id/A"
              android:textOn=""
              android:textOff=""
              android:background="@layout/A"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_marginLeft="60dp"
              android:layout_marginRight="30dp"
          /&gt;
          &lt;ToggleButton
              android:id="@+id/B"
              android:textOn=""
              android:textOff=""
              android:background="@layout/B"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_marginLeft="30dp"
              android:layout_marginRight="30dp"
          /&gt;
      &lt;/LinearLayout&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Buttons C,D,E xml file:</p>
  
  <pre><code>&lt;RelativeLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:baselineAligned="true"
  &gt;
      &lt;LinearLayout
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerHorizontal="true"
      &gt;
          &lt;ImageView 
              android:id="@+id/C"
              android:src="@drawable/C"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_marginLeft="30dp"
              android:layout_marginRight="30dp"
          /&gt;
          &lt;ImageView 
              android:id="@+id/D"
              android:src="@drawable/D"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_marginLeft="30dp"
              android:layout_marginRight="30dp"
          /&gt;
          &lt;ImageView 
              android:id="@+id/E"
              android:src="@drawable/E"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_marginLeft="30dp"
              android:layout_marginRight="30dp"
          /&gt;
      &lt;/LinearLayout&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>My code basically works, but I have to fudge with the margins to make things line up correctly (which they don't yet).  I wonder if there's some cleaner way of center aligning button-sets "A B"  and "C D E"</p>
  
  <p>ps: the astute reader will notice that I'm extending LinearLayout, but inflating RelativeLayouts.  (I don't know why it can even work at all, but) when I tried extending RelativeLayout instead, the "C D E" layout didn't even appear on my device.  I don't know where it went.</p>