Arranging UI components

You can arrange the UI components on an application screen by using
BlackBerry® API layout managers. The following classes
extend the
Manager class that is provided in the
net.rim.device.apu.ui package and provide predefined
layouts for the UI components on your application's screen.

Layout manager

Description

FlowFieldManager

This layout manager arranges UI components vertically and then
horizontally depending on the size of the screen. The first UI component is
positioned in the upper-left corner of the screen and subsequent components are
placed horizontally to the right of the first component until the width of the
screen is reached. Once UI components can no longer fit on the first row, the
next UI component is placed below the first row of components on a row that has
a height that is equal to the tallest component of the row above it. You can
apply vertical style bits (for example,
Field.FIELD_TOP,
Field.FIELD_BOTTOM, or
Field.FIELD_VCENTER) to align UI components
vertically within their row.

HorizontalFieldManager

This layout manager arranges UI components in a single
horizontal row starting at the left side of the screen and ending at the right
side of the screen. Because this layout manager arranges UI components
horizontally, you cannot apply horizontal style bits to UI components (for
example,
Field.FIELD_LEFT,
Field.FIELD_HCENTER, or
Field.FIELD_RIGHT). You can apply vertical
style bits (for example,
Field.FIELD_TOP,
Field.FIELD_BOTTOM, or
Field.FIELD_VCENTER).

If the UI components do not fit the available width of the
screen, you should use the
Manager.HORIZONTAL_SCROLL style bit to enable
horizontal scrolling. Otherwise, the screen displays as many UI components as
possible within the available screen width, and the rest are not shown. The UI
components exist but are not visible. This situation can create unexpected
scrolling behavior for your users.

VerticalFieldManager

This layout manager arranges UI components in a single
vertical column starting at the top of the screen and ending at the bottom of
the screen. Because this layout manager is designed to arrange items
vertically, you cannot apply vertical style bits to UI components (for example,
Field.FIELD_TOP,
Field.FIELD_BOTTOM, or
Field.FIELD_VCENTER). You can apply horizontal
style bits (for example,
Field.FIELD_LEFT,
Field.FIELD_HCENTER, or
Field.FIELD_RIGHT).

You can use additional layout managers to arrange UI components in your
application. For example, you can use the
GridFieldManager layout manager to position UI
components in rows and columns on a screen to create a grid. You can use the
EyelidFieldManager layout manager to display UI
components on a pair of managers that appear at the top and bottom of the
screen temporarily.