I have a LinearLayout that contains two TextViews. Let the first TextView text be "short text" and the second TextView text be "(s)".
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/variable-size"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:ellipsize="middle"
android:lines="1"
android:singleLine="true"
android:text="short text"/>
<TextView
android:id="@+id/fixed-size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="none"
android:lines="1"
android:singleLine="true"
android:text="(s)" />
</LinearLayout>
I want LinearLayout to be displayed to the user this way:
[[short text][(s)]____________]
where ____means empty view.
Now, if I put a slightly long line in the first TextView, I want to see this:
[[slightly longer text][(s)]__]
and if I put a much longer line in the first TextView, I want to see this:
[[really long ...ng text][(s)]]
But I cannot find a way to keep the first TextView from crowding out the second TextView as a whole, for example:
[[really long lo... long text]]
How do I get the behavior I'm looking for?