The idea is to have vertical chain with different spaces between items. To be more clear, here is an example of desired behaviour for LinearLayout.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="300dp"
android:background="@android:color/darker_gray"
android:orientation="vertical">
<View
android:id="@+id/space1"
android:layout_width="match_parent"
android:layout_weight="2"
android:layout_height="0dp" />
<View
android:id="@+id/contentView1"
android:layout_width="match_parent"
android:layout_weight="0"
android:layout_height="70dp"
android:background="@android:color/black" />
<View
android:id="@+id/space2"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="0dp" />
<View
android:id="@+id/contentView2"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_weight="0"
android:background="@android:color/black" />
<View
android:id="@+id/space3"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="0dp" />
</LinearLayout>
Here layout_weight="0" makes content view wrapping its height. layout_weight="1" and layout_weight="2" makes view filling available free space proportionally to its weight. If content views become bigger, spaces become smaller (if no room, no spaces).
Since the target UI is more complex than just vertical stack, I'd like to use ConstraintLayout instead of LinearLayout. But I don't see a way to set percentage for chain spaces.
Thanks fo your suggestions.