It seems that a TextView inside a LinearLayout forces that LinearLayout to be larger. I am trying split my screen top 50% and bottom 50% and also the bottom 50% is split into 3 parts. So I did my weights 3 (for the top), and then 1, 1, 1 (for the bottom) for a total of 6.
Here is what it looks like. http://i.imgur.com/3FJSW.jpg
As soon as I take out the TextView inside the first LinearLayout the splits are proper. The moment I put the TextView inside the top LinearLayout the top LinerLayout gets larger by the amount of the the TextView.
Here is my code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="#cccccc"
android:layout_weight="3">
<TextView
android:text="@string/hello"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="#aa0000"
android:layout_weight="1">
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="#00aa00"
android:layout_weight="1">
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="#0000cc"
android:layout_weight="1">
</LinearLayout></LinearLayout>