I have a code like this:
...
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:weightSum="10">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="8">
<TextView android:id="@+id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
...
This code is nested in other linearlayout’s which have the same weightSum and weight.
The SDK I use is 1.6 Android. I cannot figure out why the amount of space assigned to the elements with weight equal to 1 is different if I remove the TextView in the middle. It seems that even if the Text size (number of chars) of the TextView are more, the LinearLayouts with weight 1 got’s smaller .. How is this possible?
I found the solution. Practically I needed to set the Layout_width of each container with the weight property to 0px.