Layout manager is use for arranging the GUI component in container…..

LinearLayout – displays View-elements as a single row (if it is Horizontal) or a single column (if it is Vertical). I used it in the previous lesson, when demonstrating usage of layout-files during screen orientation change.

TableLayout – displays elements in the form of a table, with rows and columns.

RelativeLayout – each element’s position is configured relatively to other elements.

AbsoluteLayout – each element is specified an absolute position on the screen in the coordinate system (x, y).

Grid Layout – rows and cols

FrameLayout – Widget in a frame.

Linear Layout:-

TableLayout (TL)

TableLayout consists of rows TableRow (TR). And each TR contains View elements that form columns. So the number of Views in TR is a number of columns. But the number of columns in  a table must be equal for all rows. That’s why, when different TRs have different numbers of View-elements (columns), the overall number of columns is defined by the TR with the maximum number

Relative Layout:-

Types of relationships:

1) to the left, right, above or below the specified element (layout_toLeftOf, layout_toRightOf, layout_above, layout_below)

2) aligned by the left, right, top or bottom edge of the specified element (layout_alignLeft, layout_alignRight, layout_alignTop, layout_alignBottom)

3) aligned by the left, right, top or bottom edge of a parent (layout_alignParentLeft, layout_alignParentRight, layout_alignParentTop, layout_alignParentBottom)

4) centered vertically, centered horizontally, centered vertically and horizontally relative to its parent (layout_centerVertical, layout_centerHorizontal, layout_centerInParent)

Absolute Layout:-

Provides absolute positioning of elements on the screen. You specify the coordinates for the left top corner of the component:-

Grid Layout:–


Common UI component:-

UI Controls

  • Button
  • TextView
  • EditText
  • CheckBox
  • RadioButton
  • ToggleButton
  • Spinner
  • AutoCompleteTextView
  • Progress Bar
  • Pickers
  • ImageView


Please enter your comment!
Please enter your name here