What is layout & how many layouts are available in Android

What is layout & how many layouts are available in Android?

Posted on

Before you start creating your own application you need to know about android layouts. Using that you can create your application UI (User Interface). If your application UI is better then other applications then the users like your application. So, I think you definitely want to learn how to create better UI then let’s first understand what is the layout.

What is Layout?

The android layout is used to define the user interface which holds the different UI controls that will appear on the screen. Basically, any application has one or more activities and we say the activity is one page of the application. Each activity contains interface components and those components are the instances of the View and ViewGroup.

Types of Android Layout:-

types of android layout

1. Linear Layout:– It is used to provide child view elements one by one in a particular direction. This means you can set your child view elements either horizontally or vertically based on the orientation property.

Linear layout

2. Relative Layout:- It is used to specify the position of child view elements relative to each other like or relative to the parent. For example, we have Button A and we need to set that button to the right of Button B then at that time we need this layout.

3. Constraint Layout:- It is used to specify the position of layout constraints for every child view relative to other views present. It is basically similar to a Relative Layout, but it having more power.

Constraint layout

4. Table Layout:- It is used to display the child view elements in rows and columns.

5. Frame Layout:- It is used to specify the position of View elements it contains on the top of each other to display only a single View inside the FrameLayout.

6. Web View:- it is used to display the web pages in our activity layout or also we say it works like a web browser.

7. List View:- ListView is a ViewGroup, used to display a scrollable list of items in a single column.

8. Grid View:- GridView is a ViewGroup that is used to display a scrollable list of items in the grid view of rows and columns.

I give you the example of Linear Layout so you can batter understand the code. So when you want to create any other layout then you can easily do it. so let’s see…..

<?xml version="1.0" encoding="utf-8"?> 
	xmlns:android="http:// schemas.android.com/apk/res/android"
	xmlns:tools="http:// schemas.android.com/tools"

	<!--EditText with id editText--> 
    <!-- You can also set horizontal orientation -->


	<!--Button with id showInput--> 



So that is how we create our layout in android but if you want to learn how to add different view elements in our layout then click on the below link.

Use of Android View Classes.

If you want to learn to create your own application then keep visiting our website because I give you the best articles related to android.

Many of you are interested in Python, So if you want to learn python language then click on the below link. Also share it with your friend. who really wants to learn python.


Also Read :-

Now, at the end of this article, I thank all those people who read this article. If you like this article and you think this article is useful for any person then share it with that person.

Leave a Reply

Your email address will not be published. Required fields are marked *