Skip to content

Instantly share code, notes, and snippets.

@seventhmoon
Created March 14, 2017 07:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seventhmoon/17806bcf5890387b5f5770cd7fb246a0 to your computer and use it in GitHub Desktop.
Save seventhmoon/17806bcf5890387b5f5770cd7fb246a0 to your computer and use it in GitHub Desktop.
FlexboxLayout
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.flexbox.FlexboxLayout 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="wrap_content"
app:flexWrap="wrap"
android:layout_gravity="center"
app:alignItems="center"
tools:context="com.androidfung.layoutsample.MainActivity">
<android.support.v7.widget.CardView
android:layout_width="320dp"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:minWidth="320dp"
app:layout_flexGrow="1"
app:layout_gravity="center"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="320dp"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:minWidth="320dp"
app:layout_flexGrow="1"
app:layout_gravity="center"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.v7.widget.CardView> <android.support.v7.widget.CardView
android:layout_width="320dp"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:minWidth="320dp"
app:layout_flexGrow="1"
app:layout_gravity="center"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.v7.widget.CardView>
</com.google.android.flexbox.FlexboxLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment