In my layout I have two different LinearLayouts. The first one is this:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="8"
android:gravity="center"
android:text="@string/lblPais" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/lblJ" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/lblG" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/lblP" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/lblPF" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/lblPC" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/lblDif" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/lblPuntos" />
</LinearLayout>
And the second one is this layout:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="15" >
<TextView
android:id="@+id/lblPais1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="8"
android:gravity="center"
android:text="@string/lblPais" />
<TextView
android:id="@+id/lblJ1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/lbl0" />
<TextView
android:id="@+id/lblG1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/lbl0" />
<TextView
android:id="@+id/lblP1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/lbl0" />
<TextView
android:id="@+id/lblPF1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/lbl0" />
<TextView
android:id="@+id/lblPC"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/lbl0" />
<TextView
android:id="@+id/lblDif1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/lblPtsVacio" />
<TextView
android:id="@+id/lblPuntos1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/lblPtsVacio" />
</LinearLayout>
As you can see both layouts get the same value for the layout_width
attribute (match_parent
). Inside both layouts I have the same number of elements (8 TextView). Each TextView has the same weight except the first one, that has a weight of 8.
If both layouts are the same (only differ the label on the TextViews) why do they have different sizes?