I have this as part of my layout:
<LinearLayout android:layout_width="fill_parent" android:layout_height="0dip" android:orientation="horizontal" android:layout_weight="0.15"> <TextView android:id="@+id/question_text" android:layout_width="0dip" android:layout_height="fill_parent" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right" android:text="@string/score_label" /> <TextView android:id="@+id/score_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right" /> </LinearLayout> The first TextView is empty at the beginning of the application. Its content is changed dynamically. This makes it occupy zero space so that the second TextView is aligned to the left, even though its layout_gravity is set to right.
How can I make it occupy a fixed width, without taking the contents into account?
I thought about using layout_weight, but I know the recommendation is against using nested weights (the parent ViewGroup has a layout_weight attribute). Maybe I should use a RelativeLayout?
Thanks for any suggestions.