You are on page 1of 8

Android Layouts

Kerikuma Oshilim
Introduction
A layout defines the visual structure for a user interface, such as the
UI for an activity or app widget. You can declare a layout in two ways:
Declare UI elements in XML. Android provides a straightforward XML
vocabulary that corresponds to the View classes and subclasses, such
as those for widgets and layouts.
Instantiate layout elements at runtime. Your application can create
View and ViewGroup objects (and manipulate their properties)
programmatically.
View Groups and View
In an Android application, the user interface is built using View and
View Group objects. There are many types of views and view groups,
each of which is a descendant of the View class.
The View Group class serves as the base for subclasses called
"layouts," which offer different kinds of layout architecture, like linear,
tabular and relative.
Layouts
Absolute layout
Linear layout
Relative layout
Table layout
Grid layout
List layout
Linear layout
A layout that organizes its children into a single horizontal or vertical
row. It creates a scrollbar if the length of the window exceeds the
length of the screen.
Relative layout
Enables you to specify the location of child objects relative to each
other (child A to the left of child B) or to the parent (aligned to the
top of the parent).
Table Layout
The Table Layout layout is an extension of LinearLayout. As the name
indicates, Table Layout is used to display child View elements in rows
and columns.
List View
ListView is used to display a collection of data in a vertical scrollable
rows.
The list items are automatically inserted to the list using a Adapter.

You might also like