Pr.Pg Next Pg

Layouts tutorials

UI Overview

  • All user interface elements in an Android app are built using View and ViewGroup objects. A View is an object that draws something on the screen that the user can interact with. A ViewGroup is an object that holds otherView (and ViewGroup) objects in order to define the layout of the interface.The figure below illustrates the view hierarchy which define the UI layout.


Android Layouts

  • An Android layout is a class that handles arranging the way its children appear on the screen.

  • A layout resource is simply a template for a user interface screen, or portion of a screen, and contain.

  • A type of View class whose primary purpose is to organize other controls. These layout classes (LinearLayout, RelativeLayout, TableLayout, etc. ) are used to display child controls, such as text controls or buttons or images on the screen.


Commonly used Layouts

  • Now let’s turn our attention to those helpful layout controls that organize other controls. The most commonly used layout classes are:


  • FrameLayout :-  designed to display a stack of child View controls. Multiple view controls can be added to this layout. This can be used to show multiple controls within the same screen space.


  • LinearLayout  :- designed to display child View controls in a single row or column. This is a very handy layout method for creating forms.


  • RelativeLayout  :- designed to display child View controls in relation to each other. For instance, you can set a control to be positioned “above” or “below” or “to the left of” or “to the right of” another control, referred to by its unique identifier. You can also align child View controls relative to the parent edges.


  • TableLayout  :- designed to organize child View controls into rows and columns. Individual View controls are added within each row of the table using a TableRow layout View (which is basically a horizontally oriented LinearLayout) for each row of the table.


Pr.Pg border                                              Next Pg