Understanding Layout Managers

Like Swing, Android offers a collection of view classes that act as containers for views. These container classes are called layouts (or layout managers), and each implements a specific strategy to manage the size and position of its children. For example, the LinearLayout class lays out its children either horizontally or vertically, one after the other.

The layout managers that ship with the Android SDK are defined in Table 4-2.

Table 4-2. Android Layout Managers

Layout Manager Description

LinearLayout Organizes its children either horizontally or vertically.

TableLayout Organizes its children in tabular form.

RelativeLayout Organizes its children relative to one another or to the parent.

AbsoluteLayout Positions children based on exact coordinates.

FrameLayout Allows you to dynamically change the control(s) in the layout.

We will discuss these layout managers in the sections that follow.

0 0

Post a comment