Layouts in android

In this article, We will learn about android layouts and how to use layouts in android.


Layouts define the structure of applications. This is used for arranging elements like images, text, buttons etc in proper structure. In other words, layout  is like a container that holds several view elements inside it. This helps to make design user interactive and attractive.

Whenever you develop an application, you first need to choose the layout and style it accordingly to make your application look better. Every Layout in android is styled using the XML language, as shown below.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=""
       android:text="TechVidvan Android"

Types of  layouts:

  • Linear Layout: We use this layout to place the elements in a linear manner. A Linear manner means one element per line. Used to arrange child View elements  one by one in a particular direction either horizontally or vertically based on the orientation property.
  • Relative Layout: This layout is used for specifying the position of the elements in relation to the other elements that are present there. Used to specify the position of child View elements relative to each other like (A to the top of B) or relative to the parent. Relative Layout is used when you wish to place views  relative to each other’s position.
  • Constraint Layout: Constraint Layout is a View Group subclass, used to specify the position of layout constraints for every child View relative to other views present. A Constraint Layout is similar to a Relative Layout, but having more power.
  • Frame Layout: Frame Layout is used when you work with fragments. This layout allows you to have only  one child view.
  • Table Layout: Table Layout is used to display the items(such as text, image, etc) in the form of rows and columns.
  • Web View: WebView is a browser that is used to display the web pages in our activity layout. WebView is a layout that is used mainly when dealing with web pages inside the application.
  • List View:  List View is used to display your items in the form of a list.
  • Grid View:  Grid View is used to show your data in the form of a grid of one’s, two’s, three’s, or so on. 

Submit a Comment

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


Select Categories