You can use weighted horizontal LinearLayout, like this:
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:gravity="center_horizontal"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="i am centered"
android:ellipsize="end"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="another widget"/>
.
.
.
</LinearLayout>
TextViewwith a width of 0dp and a weight of 1 will use the remaining horizontal space.
You can add additional widgets to LinearLayout, and TextViewwill always occupy the remaining space.
, Button GONE, , TextView , . , LinearLayout, TextView.
ellipsize, , , TextView.