Created
August 25, 2018 21:58
-
-
Save RamiJ3mli/0c7d42f0e08556460c82ae70f002c41d to your computer and use it in GitHub Desktop.
All child views' widths have to match the widest child view's width
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<android.support.constraint.ConstraintLayout 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"> | |
<TextView | |
android:id="@+id/button1_txt" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:elevation="8dp" | |
android:padding="16dp" | |
android:text="text" | |
android:textColor="@android:color/black" | |
app:layout_constraintBottom_toTopOf="@+id/button2_txt" | |
app:layout_constraintLeft_toLeftOf="parent" | |
app:layout_constraintRight_toRightOf="parent" | |
app:layout_constraintTop_toTopOf="parent" | |
app:layout_constraintVertical_bias="0.2" | |
app:layout_constraintVertical_chainStyle="packed" /> | |
<TextView | |
android:id="@+id/button2_txt" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_marginTop="16dp" | |
android:elevation="8dp" | |
android:padding="16dp" | |
android:text="Long text" | |
android:textColor="@android:color/black" | |
app:layout_constraintBottom_toTopOf="@+id/button3_txt" | |
app:layout_constraintLeft_toLeftOf="parent" | |
app:layout_constraintRight_toRightOf="parent" | |
app:layout_constraintTop_toBottomOf="@+id/button1_txt" /> | |
<TextView | |
android:id="@+id/button3_txt" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_marginTop="16dp" | |
android:elevation="8dp" | |
android:padding="16dp" | |
android:text="An extremely long text!" | |
android:textColor="@android:color/black" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintLeft_toLeftOf="parent" | |
app:layout_constraintRight_toRightOf="parent" | |
app:layout_constraintTop_toBottomOf="@+id/button2_txt" /> | |
<View | |
android:id="@+id/button1" | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
android:background="@drawable/bg" | |
app:layout_constraintBottom_toBottomOf="@+id/button1_txt" | |
app:layout_constraintLeft_toLeftOf="@+id/left_barrier" | |
app:layout_constraintRight_toRightOf="@+id/right_barrier" | |
app:layout_constraintTop_toTopOf="@+id/button1_txt" /> | |
<View | |
android:id="@+id/button2" | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
android:background="@drawable/bg" | |
app:layout_constraintBottom_toBottomOf="@+id/button2_txt" | |
app:layout_constraintLeft_toLeftOf="@+id/left_barrier" | |
app:layout_constraintRight_toRightOf="@+id/right_barrier" | |
app:layout_constraintTop_toTopOf="@+id/button2_txt" /> | |
<View | |
android:id="@+id/button3" | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
android:background="@drawable/bg" | |
app:layout_constraintBottom_toBottomOf="@+id/button3_txt" | |
app:layout_constraintLeft_toLeftOf="@+id/left_barrier" | |
app:layout_constraintRight_toRightOf="@+id/right_barrier" | |
app:layout_constraintTop_toTopOf="@+id/button3_txt" /> | |
<android.support.constraint.Barrier | |
android:id="@+id/right_barrier" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
app:barrierDirection="end" | |
app:constraint_referenced_ids="button1_txt, button2_txt, button3_txt" /> | |
<android.support.constraint.Barrier | |
android:id="@+id/left_barrier" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
app:barrierDirection="start" | |
app:constraint_referenced_ids="button1_txt, button2_txt, button3_txt" /> | |
</android.support.constraint.ConstraintLayout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment