by helsy infotech    1 day ago

Introduction

The most commonly used layouts are:

  1. Linear Layout
  2. Relative Layout

1. Linear Layout :-

In a linear layout, as the name suggests, all the elements are displayed in a linear fashion.

Linear Layout are arranged in two ways:-

  1. Horizontally
  2. Vertically.

This behaviour is set in android: orientation which is an attribute of the node LinearLayout.

2. Relative Layout :-

The name suggests, all the elements are arranged in relative fashion it means element arrange itself relative to other elements or it's parent element.

The most commonly used layouts are:

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

Table Layout :-

Table layouts in Android work like HTML table layouts work.

In the table layout, all layout arrange in row and column fashion.

Frame Layout :-

FrameLayout should be used to hold a single child view because it can be difficult to organize child views in a way that's scalable to different screen sizes without the children overlapping each other.

Frame Layout is designed to block out an area on the screen to display a single item.

List View :-

Android Listview is one kind of view that combines several items.

List view display item in vertical Scrollable list fashion. In Listview items are inserted using the adapter that pulls content from a source such as an array or database.

Grid View Layout:-

Android GridView shows items in two-dimensional scrolling grid (rows & columns) and the grid items are not necessarily predetermined but they automatically inserted to the layout using a ListAdapter.