Android Basics – Learn about the Grid Layout

Introduction

Grid Layout is very useful if you want your App to display elements in Rows and Columns.

This Layout allows you to divide your UI into Rows and Columns similar to HTML tables.

Doing this is pretty simple. Please refer to the Image.

I have recorded a Video to help you understand how to use this Layout.

Some Code Snippets

<GridLayout xmlns:android=”http://schemas.android.com/apk/res/android&#8221;
android:layout_width=”match_parent”
android:layout_height=”match_parent”
android:columnCount=”2″>

<TextView
android:layout_height=”wrap_content”
android:layout_width=”wrap_content”
android:layout_row=”0″
android:layout_column=”0″
android:text=”Email”
android:layout_margin=”5dp”
android:padding=”5dp”
/>

The Source Code is available at : https://github.com/ankur-srivastava/HelloAndroid/blob/master/app/src/main/res/layout/grid_layout.xml

Author: androidsmartly

I am a Tech Enthusiast who likes to work on new Ideas. Sharing knowledge on Android, Marketing, Startups and More.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s