title: Android stretch layout heights so that layout takes up 50% of screen
body: <p>I have a LinearLayout that contains sublayouts which essentially mimick a 3x2 grid. Each sublayout takes up an equal amount of space across the screen (in width).  Now, I'm looking to have the two rows of sublayouts stretch in height so that each takes up 50% of the screen.  I've tried playing around with the weights, however I don't know how to modify my existing layout code without messing up the existing weights in place used for the widths.  Can anyone provide me with some help?  Thanks! Here is my layout code:</p>
  
  <pre><code>&lt;LinearLayout
          android:orientation="horizontal"
          android:layout_width="fill_parent"
          android:layout_marginBottom="2dip"
          android:layout_height="wrap_content"    &gt;
  
              &lt;LinearLayout
                  android:orientation="vertical"
                  android:layout_width="0dp"
                  android:layout_weight="50"
                  android:padding="10dip"
                  android:layout_marginRight="1dip"
                  android:background="@drawable/detail_row"
                  android:layout_height="wrap_content"    &gt;
  
                      &lt;ImageView
                          android:id="@+id/menuImage1"
                          android:layout_gravity="center_horizontal|center_vertical"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content" /&gt;
  
                      &lt;TextView
                          android:id="@+id/textImage1"
                          android:layout_column="1"
                          android:layout_gravity="center_horizontal|center_vertical"
                          android:text=""
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content" /&gt;
  
              &lt;/LinearLayout&gt;
  
  
              &lt;LinearLayout
                  android:orientation="vertical"
                  android:layout_width="0dp"
                  android:layout_weight="50"
                  android:padding="10dip"
                  android:layout_marginLeft="1dip"
                  android:layout_marginRight="1dip"
                  android:background="@drawable/detail_row"
                  android:layout_height="wrap_content"    &gt;
  
                      &lt;ImageView
                          android:id="@+id/menuImage2"
                          android:layout_gravity="center_horizontal|center_vertical"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content" /&gt;
  
                      &lt;TextView
                          android:id="@+id/textImage2"
                          android:layout_column="1"
                          android:layout_gravity="center_horizontal|center_vertical"
                          android:text=""
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content" /&gt;
  
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:orientation="vertical"
                  android:layout_width="0dp"
                  android:layout_weight="50"
                  android:padding="10dip"
                  android:layout_marginLeft="1dip"
                  android:background="@drawable/detail_row"
                  android:layout_height="wrap_content"    &gt;
  
                      &lt;ImageView
                          android:id="@+id/menuImage3"
                          android:layout_gravity="center_horizontal|center_vertical"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content" /&gt;
  
                      &lt;TextView
                          android:id="@+id/textImage3"
                          android:layout_column="1"
                          android:layout_gravity="center_horizontal|center_vertical"
                          android:text=""
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content" /&gt;
  
              &lt;/LinearLayout&gt;
  
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:orientation="horizontal"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"    &gt;
  
              &lt;LinearLayout
                  android:orientation="vertical"
                  android:layout_width="0dp"
                  android:layout_weight="50"
                  android:padding="10dip"
                  android:layout_marginRight="1dip"
                  android:background="@drawable/detail_row"
                  android:layout_height="wrap_content"    &gt;
  
                      &lt;ImageView
                          android:id="@+id/menuImage4"
                          android:layout_gravity="center_horizontal|center_vertical"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content" /&gt;
  
                      &lt;TextView
                          android:id="@+id/textImage4"
                          android:layout_column="1"
                          android:layout_gravity="center_horizontal|center_vertical"
                          android:text=""
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content" /&gt;
  
              &lt;/LinearLayout&gt;
  
  
              &lt;LinearLayout
                  android:orientation="vertical"
                  android:layout_width="0dp"
                  android:layout_weight="50"
                  android:padding="10dip"
                  android:layout_marginLeft="1dip"
                  android:layout_marginRight="1dip"
                  android:background="@drawable/detail_row"
                  android:layout_height="wrap_content"    &gt;
  
                      &lt;ImageView
                          android:id="@+id/menuImage5"
                          android:layout_gravity="center_horizontal|center_vertical"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content" /&gt;
  
                      &lt;TextView
                          android:id="@+id/textImage5"
                          android:layout_column="1"
                          android:layout_gravity="center_horizontal|center_vertical"
                          android:text=""
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content" /&gt;
  
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:orientation="vertical"
                  android:layout_width="0dp"
                  android:layout_weight="50"
                  android:padding="10dip"
                  android:layout_marginLeft="1dip"
                  android:background="@drawable/detail_row"
                  android:layout_height="wrap_content"    &gt;
  
                      &lt;ImageView
                          android:id="@+id/menuImage6"
                          android:layout_gravity="center_horizontal|center_vertical"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content" /&gt;
  
                      &lt;TextView
                          android:id="@+id/textImage6"
                          android:layout_column="1"
                          android:layout_gravity="center_horizontal|center_vertical"
                          android:text=""
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content" /&gt;
  
              &lt;/LinearLayout&gt;
  
      &lt;/LinearLayout&gt;
  </code></pre>