Цепные цепочки в ConstraintLayout для Android - PullRequest
2 голосов
/ 18 марта 2019

Как объединить несколько цепочек разных стилей (распространено, упаковано ...) в макет ограничения?

Другими словами, как создать цепочку групп представлений, которые уже находятся в цепочке разного стиляна той же оси (горизонтальная / вертикальная)? enter image description here

Как показано на рисунке:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">

<Button
    android:id="@+id/view1"
    android:text="VIEW 1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" 
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintBottom_toTopOf="@+id/view2"/>
<Button
    android:id="@+id/view2"
    android:text="VIEW 2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/view1"
    app:layout_constraintBottom_toTopOf="@+id/view3"/>

<Button
    android:id="@+id/view3"
    android:text="VIEW 3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/view2"
    app:layout_constraintBottom_toTopOf="@+id/view4"/>

<Button
    android:id="@+id/view4"
    android:text="VIEW 4"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/view3"
    app:layout_constraintBottom_toBottomOf="parent"/>

</android.support.constraint.ConstraintLayout>

Preview of current xml code:

...