Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.