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

Android Basics – Learn about Relative, Linear and Grid Layouts

In this Post you will learn the basics of using Layouts. Layouts enable you to position the UI elements on the App Screens.

You can refer to the image and the video to understand the concept better.

You can use three types of Layouts

Relative Layout

Use this Layout to position the UI elements relative to each other.

Continue reading “Android Basics – Learn about Relative, Linear and Grid Layouts”