I have created layout like this one
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/top"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@color/gray"
android:gravity="center"
android:padding="10dp"
android:text="top"
android:textColor="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/middle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@color/green"
android:gravity="center"
android:minHeight="300dp"
android:padding="10dp"
android:text="middle"
android:textColor="@color/white"
app:layout_constraintBottom_toTopOf="@id/bottom"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/top" />
<TextView
android:id="@+id/bottom"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@color/gray"
android:gravity="center"
android:padding="10dp"
android:text="bottom"
android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</android.support.constraint.ConstraintLayout>
It does scroll on small screens as expected.
But on larger screens it leaves space below
How can I make layout match screen height, but still be scrollable on small screens?
Tried to set 'middle' height to 0dp, but this did not help.
Adding android:fillViewport="true"
to ScrollView
and set middle's height to 0dp
solves the problem with space, but brings problem with scrolling - on small screens middle is shrinking, instead of scrolling.