title: Should I use LinearLayout or RelativeLayout to have 4 objects fill a screen?
body: <p>I am learning about the difference between <code>LinearLayout</code> and <code>RelativeLayout</code> and am confused about the best way to solve my specific problem. I want to have 4 buttons fill a screen, each with some different action. After having trouble with <code>RelativeLayout</code>, I was recommended to switch to <code>LinearLayout</code> by <a href="https://stackoverflow.com/questions/6982395/set-two-buttons-to-same-width-regardless-of-screen-size">this</a> SO thread. Using a nested <code>LinearLayout</code> and the <code>android:weight</code> value, I got a solution that does work properly. However, now I get the warning: "Nested weights are bad for performance." I propmtly looked that up on SO and found <a href="https://stackoverflow.com/questions/9430764/why-are-nested-weights-bad-for-performance-alternatives">this</a> article, telling me to switch back to <code>RelativeLayout</code>. </p>
  
  <p>What's the right answer? Is there a good way to have objects fill an area like this in <code>RelativeLayout</code>? </p>
  
  <p>This is my current code. Excuse the extra stuff, not sure what to leave in and what to just take out.</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:id="@+id/motherStack"
  android:layout_width="match_parent"
  android:layout_height="match_parent" 
  android:orientation="vertical"
  android:paddingBottom="@dimen/activity_vertical_margin"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  tools:context=".MainActivity" &gt;
  
  &lt;LinearLayout 
      android:id="@+id/rowOne"
      android:layout_height="wrap_content"
      android:layout_width="match_parent"
      android:layout_weight="1"&gt;
  
  
      &lt;Button
          android:id="@+id/redButton"
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:layout_weight="1"
          android:text="@string/red_button_text"
          android:textColor="@color/RED" /&gt;
  
      &lt;Button
          android:id="@+id/blueButton"
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:layout_weight="1"
          android:text="@string/blue_button_text"
          android:textColor="@color/BLUE" /&gt; 
  &lt;/LinearLayout&gt;
  
  &lt;LinearLayout 
      android:id="@+id/rowTwo"
      android:layout_height="wrap_content"
      android:layout_width="match_parent"
      android:layout_weight="1"&gt;
      &lt;Button
          android:id="@+id/greenButton"
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:layout_weight="1"
          android:text="@string/green_button_text"
          android:textColor="@color/GREEN" /&gt;
  
      &lt;Button
          android:id="@+id/yellowButton"
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:layout_weight="1"
          android:text="@string/yellow_button_text"
          android:textColor="@color/YELLOW" /&gt; 
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>I would post an image but I just joined and have no reputation. :(</p>