The easiest way to do this is to use layout_weight with LinearLayout . Note that the width of the first TextView is "0dp" , which means "ignore me and use weight." Weight can be any number; since it is the only balanced species, it will expand to fill the available space.
<LinearLayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" > <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" /> <TextView android:layout_width="25dp" android:layout_height="wrap_content" /> </LinearLayout>
source share