I have a LinearLayout that has four views laid out horizontally. The first and last components are the specified size. For two internal views, I just want to share the available 50:50 space. I set each weight to “1,” but when I view the views, the views vary in size depending on the content they store. 
Here is my xml layout for reference.
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content"> <ImageView android:id="@+id/status" android:src="@drawable/white" android:paddingRight="10dip" android:layout_height="35dip" android:layout_width="35dip"> </ImageView> <TextView android:id="@+id/name" android:text="Name" android:layout_height="fill_parent" android:layout_toRightOf="@id/status" android:layout_width="wrap_content" android:layout_weight="1" android:textSize="25dip"> </TextView> <TextView android:id="@+id/description" android:text="Description" android:layout_toRightOf="@id/name" android:layout_height="fill_parent" android:layout_width="wrap_content" android:layout_weight="1" android:textSize="25dip"> </TextView> <TextView android:id="@+id/time" android:text="Time" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_toRightOf="@id/description" android:textSize="25dip"> </TextView> </LinearLayout>
Obviously, these are not actual column names, but I changed them for privacy purposes. This layout is used by ListView, which changes the text of each view as any value. The name and description fields should line up, as they are given 50% of the remaining screen, but when the name is longer, the description is shifted to the right. Why?
Spidy source share