问题
so the idea was to create a constraint layout containing several numbers of the same constraint layout as includes.
Therefore I created a layout of my desire and include it several times. But for now all includes are just stacked on top of each other. But what I actual wanted, is that they are evenly vertically distributed across the screen.
Isn't it possible to have constraints between includes?
Here is how my current layout looks like.
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_main"
tools:context=".MainActivity">
<include
android:id="@+id/LayoutSets"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout="@layout/setter_numeric_layout"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintVertical_bias="0.5"
app:layout_constraintBottom_toTopOf="@+id/LayoutHangTime"/>
<include
android:id="@+id/LayoutHangTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout="@layout/setter_numeric_layout"
app:layout_constraintTop_toBottomOf="@+id/LayoutSets"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="24dp"
app:layout_constraintVertical_bias="0.5"
app:layout_constraintBottom_toTopOf="@+id/LayoutPauseTime"/>
<include
android:id="@+id/LayoutPauseTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout="@layout/setter_numeric_layout"
app:layout_constraintTop_toBottomOf="@+id/LayoutHangTime"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintVertical_bias="0.5"
app:layout_constraintBottom_toTopOf="@+id/LayoutRounds"/>
<include
android:id="@+id/LayoutRounds"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout="@layout/setter_numeric_layout"
app:layout_constraintTop_toBottomOf="@+id/LayoutPauseTime"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintVertical_bias="0.5"
app:layout_constraintBottom_toTopOf="@+id/LayoutRestTime"/>
<include
android:id="@+id/LayoutRestTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout="@layout/setter_numeric_layout"
app:layout_constraintTop_toBottomOf="@+id/LayoutRounds"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintVertical_bias="0.5"/>
This is how my whole design looks like. Everything is stacked on top of each other.
来源:https://stackoverflow.com/questions/56314530/nested-include-constraint-layout