Created
January 25, 2013 10:26
-
-
Save Nilzor/4633342 to your computer and use it in GitHub Desktop.
Grid Layout 2x2 attempt equal sized, screen-filling attempt
This file contains hidden or 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"?> | |
<!-- REMEMBER TO UPDATE BOTH LANDSCAPE AND PORTRAIT FILES --> | |
<LinearLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:grid="http://schemas.android.com/apk/res-auto" | |
android:layout_width="fill_parent" | |
android:layout_height="fill_parent"> | |
<!-- Setting up GridLayout support library in IntelliJ: http://stackoverflow.com/questions/12468606/intellij-and-android-support-v7-widget-gridlayout --> | |
<android.support.v7.widget.GridLayout | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
grid:columnCount="2" | |
grid:rowCount="2" | |
android:background="#FFF"> | |
<LinearLayout | |
android:id="@+id/redSquare" | |
android:layout_columnSpan="1" | |
android:layout_rowSpan="1" | |
android:background="#F00" | |
grid:layout_row="0" | |
grid:layout_column="0" | |
android:layout_width="50dp" | |
android:layout_height="50dp" | |
/> | |
<LinearLayout | |
android:id="@+id/greenSquare" | |
android:layout_columnSpan="1" | |
android:layout_rowSpan="1" | |
android:background="#0F0" | |
grid:layout_row="0" | |
grid:layout_column="1" | |
android:layout_width="50dp" | |
android:layout_height="50dp" | |
/> | |
<LinearLayout | |
android:id="@+id/blueSquare" | |
android:layout_columnSpan="1" | |
android:layout_rowSpan="1" | |
android:background="#00F" | |
grid:layout_row="1" | |
grid:layout_column="0" | |
android:layout_width="50dp" | |
android:layout_height="50dp" | |
/> | |
</android.support.v7.widget.GridLayout> | |
</LinearLayout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
*********** make the GridLayout height and width as match_parent
***********and all the children layout height and width as wrap_content
<androidx.gridlayout.widget.GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:columnCount="2">