Created
June 7, 2018 06:06
-
-
Save valentincognito/af89d702b7dc356322a3adbcdf23d9ed to your computer and use it in GitHub Desktop.
GridLayout how to stretch all children evenly
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
<?xml version="1.0" encoding="utf-8"?> | |
<android.support.v7.widget.GridLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:grid="http://schemas.android.com/apk/res-auto" | |
android:id="@+id/choice_grid" | |
android:layout_width="fill_parent" | |
android:layout_height="wrap_content" | |
android:layout_centerHorizontal="true" | |
android:padding="4dp" | |
grid:alignmentMode="alignBounds" | |
grid:columnCount="2" | |
grid:rowOrderPreserved="false" | |
grid:useDefaultMargins="true"> | |
<TextView | |
android:layout_width="0dp" | |
android:layout_height="100dp" | |
grid:layout_columnWeight="1" | |
grid:layout_gravity="fill_horizontal" | |
android:gravity="center" | |
android:background="#FF33B5E5" | |
android:text="Tile1" /> | |
<TextView | |
android:layout_width="0dp" | |
android:layout_height="100dp" | |
grid:layout_columnWeight="1" | |
grid:layout_gravity="fill_horizontal" | |
android:gravity="center" | |
android:background="#FF33B5E5" | |
android:text="Tile2" /> | |
<TextView | |
android:layout_width="0dp" | |
android:layout_height="100dp" | |
grid:layout_columnWeight="1" | |
grid:layout_gravity="fill_horizontal" | |
android:gravity="center" | |
android:background="#FF33B5E5" | |
android:text="Tile3" /> | |
<TextView | |
android:layout_width="0dp" | |
android:layout_height="100dp" | |
grid:layout_columnWeight="1" | |
grid:layout_gravity="fill_horizontal" | |
android:gravity="center" | |
android:background="#FF33B5E5" | |
android:text="Tile4" /> | |
</android.support.v7.widget.GridLayout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment