Thursday, July 18, 2024
HomeAndroidAndroid Layouts and Types of Android Layouts

Android Layouts and Types of Android Layouts

-

Android Layouts:

A Layout dictates the alignment of widgets (such as Text, Buttons, EditText box) as we see in the Android Application. All the visual structure we see in an android app is designed in a Layout. Every Layout is defined in an xml file which is located in App > res > Layout in New Android Studio.
Android Layouts

In this article we are going to discuss briefly on Types of Layouts as they are going to be needed in every Android Application Project we create.

Types of Layouts:

The layouts most commonly used are:

  1. Linear Layout
  2. Relative Layout

However there are several other layouts such as:

  1. Web View Layout
  2. Frame Layout
  3. List View Layout
  4. Grid View Layout

Here we try to discuss these layouts in brief as these layouts are used extensively in any Android Project.

Linear Layout:

Linear Layout is a layout which aligns the widgets or elements in a linear (Straight) fashion. Linear Layout consists of two types of orientation:

  1. Vertical Orientation,
  2. Horizontal Orientation.

Vertical Orientation is shown above where the widgets such as Text View, Edit Text, and Button are aligned in a Vertical manner.

Android Linear Layout

Similarly there exists a Horizontal Orientation where the widgets are arranged in a horizontal manner. Horizontal orientation or Vertical orientation will be discussed further in our next articles.

Relative Layout:

Relative Layout is a layout where the widgets (such as Text Views, Buttons, etc.) are represented with respect to previous widget or parent View. A Relative Layout example is shown in the figure below.Android Relative Layout

Here in the above figure, ‘Forgot Password’ button is positioned relative to ‘Login’ Button, whereas ‘Register a new Account’ is aligned with respect to Parent Layout.

List View:

A List View is a View Layout where all the items are specified in the form of a list as shown in fig. below.

Android List View

It is one of the very useful form of layouts. List view, as shown in figure below consists of an order of List items as shown below.

List View will further be discussed in the future article along with an example.

Grid View:

A Grid View is a View Layout where the items (such as pictures, files etc.) are placed in a Grid manner as shown in figure below.

Android Grid View

These are the brief discussions on typical Android Layouts which are mostly used in Android Development. These are again explored in depth along with examples in our future tutorials.

 

 

7 COMMENTS

  1. Hi Vamsi,

    Thanks for your post, it really helped my understanding of layout views. I’ve just created learning about android application development and your blog is a great help!

    Thanks,
    Calvin

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.

LATEST POSTS

SOLID Principles in Android with Kotlin Examples

Recently I had an interview experience where I went blank when the interviewer posed an Interesting Question - Explain SOLID Principles and how they are...

Building a Multi Module App in Android | Modularization in Android #1

Recently, I was in requirement for developing a Multi Module app in Android and I was going through this great lecture on it. This article...

Lambda function in Kotlin with Examples

Lambda function is powerful feature in any Programming language and Lambda function in Kotlin is no exception. In this article, we will look at how...

Higher Order Functions in Kotlin with examples

There are many advanced features in Kotlin which gives an edge for the user using this language over Java. One such feature is Higher Order...

Follow us

1,358FansLike
10FollowersFollow
397SubscribersSubscribe

Most Popular