I am trying to build a simple layout with three views using ConstrainLayout:
When the text in the left view is very long, I want to see this:
But what I get instead is this - the left view growth too much to the right and hides middle view.
Here is my code:
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
android:id="@+id/middle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toRightOf="@id/left"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
android:id="@+id/right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toRightOf="parent"/>
</android.support.constraint.ConstraintLayout>
Some of the things I tried so far:
- making a chain and trying out different chain styles
- setting android:minWidth to Middle view to prevent it from being squashed by left view
- using Guidline to prevent the left and/or middle view to expand too far right
I spent around 4 hours trying to make things work, but so far without success. Would really appreciate help.