I have a horizontal LinearLayout with 3 text views with width set to wrap_content. I want them all to be wrap content, but there is a potential that one of them becomes too long. This results in the other two text views become out of bound. How can I make the long text view wrap content only to an extend where all children of LinearLayout are still there (within the boundary of the width of the parent LinearLayout (set to match_parent))?
Code sample:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="32dp"
android:orientation="horizontal"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="This is a very very very very very very very very very long text"
android:ellipsize="end"
android:maxLines="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="This is another text"
android:maxLines="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="One final text"
android:ellipsize="end"
android:maxLines="1"/>
</LinearLayout>
This is what I get: undesired
This is more of what I want: desired
NOTE: android:layout_weight didn't work for me because I still want the text view to wrap content for smaller texts.