Skip to content

Instantly share code, notes, and snippets.

@SG-K
Created September 5, 2020 06:33
Show Gist options
  • Save SG-K/3e69cbcceb57763598f3bfac4d923fc1 to your computer and use it in GitHub Desktop.
Save SG-K/3e69cbcceb57763598f3bfac4d923fc1 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<androidx.constraintlayout.helper.widget.Flow
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:flow_wrapMode="chain"
app:constraint_referenced_ids="btn1, btn2, btn3, btn4, btn5"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btn1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:text="Button 1"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btn2"
app:layout_constraintLeft_toRightOf="@+id/btn1"
app:layout_constraintTop_toTopOf="parent"
android:text="Button 2"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btn3"
app:layout_constraintLeft_toRightOf="@+id/btn2"
app:layout_constraintTop_toTopOf="parent"
android:text="Button 3"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btn4"
app:layout_constraintLeft_toRightOf="@+id/btn3"
app:layout_constraintTop_toTopOf="parent"
android:text="Button 4"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btn5"
app:layout_constraintLeft_toRightOf="@+id/btn4"
app:layout_constraintTop_toTopOf="parent"
android:text="Button 5"/>
</androidx.constraintlayout.widget.ConstraintLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment