I have following layout:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/dishContainer"
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="#0ff"
android:clickable="true"
android:focusable="true">
<TextView
android:id="@+id/one"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:maxLines="3"
android:background="#ff0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="One line lsfdjslkdf jksdljsdkljf sklksf klsjklsksjskfljsaklfj slkjfslkjfdskljfalskjflksdajfaklsjksadljfksfjksjkslfjsljsk lskjslksj ks flks jklsfjsl lsk slk" />
<TextView
android:id="@+id/two"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#0f0"
app:layout_constraintStart_toStartOf="@+id/one"
app:layout_constraintTop_toBottomOf="@+id/one"
app:layout_constraintBottom_toTopOf="@+id/three"
tools:text="Two kksldfj lskfd lksd jlkfsd jksld ksldfj sdlks dklfklsffsd klsdfjklsdf kdsflkj skldfsf sdfksdjf jsdfsjklfklskfls fklsf jklsdfjksf lksjdflk sdklsf lksfdjkls fk" />
<TextView
android:id="@+id/three"
android:layout_width="wrap_content"
android:background="#f00"
android:lines="1"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="@+id/two"
app:layout_constraintTop_toBottomOf="@+id/two"
app:layout_constraintBottom_toBottomOf="parent"
tools:text="Third text that dissapears, but should not go below the parent" />
</android.support.constraint.ConstraintLayout>
The problem is that green textview takes too much space and ignores top and bottom constraints. If I set green text view height to 0dp I get this:
Which is almost what I want, but if I only have very little text I get:
Here my red textview is left at the bottom, even though green text view has enough free space to shrink and let red textview go up.
Basically I want my red view to always be bellow green view, but when red hits the bottom of parent window it should stop there and also stop green textview from expanding.
How do I achieve this?