GridLayout - Xamarin


In Grid layout, you can divide your screen in rows and column to make your layout more attractive. Grid layout is mostly used in photo Gallery and others things where Grids are used.
The GridLayout is a new ViewGroup subclass that supports laying out views in a 2D grid, similar to an HTML table, as shown below:
xamarin
GridLayout is the way to go if you want to create a grid-like UI quickly and efficiently.

Example:-


<?xml version="1.0" encoding="utf-8"?>
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:columnCount="2"
    android:rowCount="3">
    <TextView
        android:layout_columnWeight="1"
        android:layout_rowWeight="1"
        android:layout_columnSpan="2"
        android:background="#F44336"
        android:textSize="70sp"
        android:text="1st" />
    <TextView
        android:layout_columnWeight="1"
        android:layout_rowWeight="1"
        android:background="#2196F3"
        android:textSize="70sp"
        android:text="2nd" />
    <TextView
        android:layout_columnWeight="1"
        android:layout_rowWeight="1"
        android:layout_rowSpan="2"
        android:background="#4CAF50"
        android:textSize="70sp"
        android:text="3rd" />
    <TextView
        android:layout_columnWeight="1"
        android:layout_rowWeight="1"
        android:background="#FFC107"
        android:textSize="70sp"
        android:text="4th" />
</GridLayout>

No comments:

Post a Comment

Xamarin Android Project App

Xamarin Android Project App 1. Xamarin -- Make a CALCULATOR Android App   https://drive.google.com/open?id=0B8OPCXLrtKPmWC1FWWtFM2lraVk...