Layout Components - App Inventor for Android

Table of Contents

HorizontalArrangement

Use a horizontal arrangement component to display a group of components laid out from left to right.

This component is a formatting element in which you place components that should be displayed from left to right. If you want to have components displayed one over another, use VerticalArrangement instead.

In a HorizontalArrangement, components are arranged along the horizontal axis, vertically center-aligned.

If a HorizontalArrangement's Height property is set to Automatic, the actual height of the arrangement is determined by the tallest component in the arrangement whose Height property is not set to Fill Parent. If a HorizontalArrangment's Height property is set to Automatic and it contains only components whose Height properties are set to Fill Parent, the actual height of the arrangement is calculated using the automatic heights of the components. If a HorizontalArrangement's Height property is set to Automatic and it is empty, the height will be 100.

If a HorizontalArrangement's Width property is set to Automatic, the actual width of the arrangement is determined by the sum of the widths of the components. If a HorizontalArrangement's Width property is set to Automatic, any components whose Width properties are set to Fill Parent will behave as if they were set to Automatic.

If a HorizontalArrangement's Width property is set to Fill Parent or specified in pixels, any components whose Width properties are set to Fill Parent will equally take up the width not occupied by other components.

Properties

AlignHorizontal
A number that encodes how contents of the arrangement are aligned horizontally. The choices are: 1 = left aligned, 2 = right aligned, 3 = horizontally centered. Alignment has no effect if the arrangement's width is automatic.
AlignVertical
A number that encodes how the contents of the arrangement are aligned vertically. The choices are: 1 = aligned at the top, 2 = aligned at the bottom, 3 = vertically centered. Alignment has no effect if the arrangement's height is automatic.
BackgroundColor
Background color for this component
Image
Background image for this component
Visible
If true, component and its contents are visible.
Height
Horizontal arrangement height (y-size).
Width
Horizontal arrangement width (x-size).

HorizontalScrollArrangement

A formatting element in which to place components that should be displayed from left to right. If you wish to have components displayed one over another, use VerticalArrangement instead.

This version is scrollable.

Properties

AlignHorizontal
A number that encodes how contents of the arrangement are aligned horizontally. The choices are: 1 = left aligned, 2 = right aligned, 3 = horizontally centered. Alignment has no effect if the arrangement's width is automatic.
AlignVertical
A number that encodes how the contents of the arrangement are aligned vertically. The choices are: 1 = aligned at the top, 2 = aligned at the bottom, 3 = vertically centered. Alignment has no effect if the arrangement's height is automatic.
BackgroundColor
Returns the component's background color
Height
HeightPercent
Image
Specifies the path of the component's image. If there is both an Image and a BackgroundColor, only the Image will be visible.
Visible
Specifies whether the component should be visible on the screen. Value is true if the component is showing and false if hidden.
Width
WidthPercent

TableArrangement

Use a table arrangement component to display a group of components in a tabular fashion.

This component is a formatting element in which you place components that should be displayed in tabular form.

In a TableArrangement, components are arranged in a grid of rows and columns, with not more than one component visible in each cell. If multiple components occupy the same cell, only the last one will be visible.

Within each row, components are vertically center-aligned.

The width of a column is determined by the widest component in that column. When calculating column width, the automatic width is used for components whose Width property is set to Fill Parent. However, each component will always fill the full width of the column that it occupies.

The height of a row is determined by the tallest component in that row whose Height property is not set to Fill Parent. If a row contains only components whose Height properties are set to Fill Parent, the height of the row is calculated using the automatic heights of the components.

Properties

Visible
If true, component and its contents are visible.
Rows (number-of-rows)
The number of rows in the table.
Columns (number-of-columns)
The number of columns in the table.
Height
Table arrangement height (y-size).
Width
Table arrangement width (x-size).

VerticalArrangement

Use a vertical arrangement component to display a group of components laid out from top to bottom, left-aligned.

This component is a formatting element in which you place components that should be displayed one below another. The first child component is stored on top, the second beneath it, and so on. If you want to have components displayed next to one another, use HorizontalArrangement instead.

In a VerticalArrangement, components are arranged along the vertical axis, left-aligned.

If a VerticalArrangement's Width property is set to Automatic, the actual width of the arrangement is determined by the widest component in the arrangement whose Width property is not set to Fill Parent. If a VerticalArrangement's Width property is set to Automatic and it contains only components whose Width properties are set to Fill Parent, the actual width of the arrangement is calculated using the automatic widths of the components. If a VerticalArrangement's Width property is set to Automatic and it is empty, the width will be 100.

If a VerticalArrangement's Height property is set to Automatic, the actual height of the arrangement is determined by the sum of the heights of the components. If a VerticalArrangement's Height property is set to Automatic, any components whose Height properties are set to Fill Parent will behave as if they were set to Automatic.

If a VerticalArrangement's Height property is set to Fill Parent or specified in pixels, any components whose Height properties are set to Fill Parent will equally take up the height not occupied by other components.

Properties

AlignHorizontal
A number that encodes how contents of the arrangement are aligned horizontally. The choices are: 1 = left aligned, 2 = horizontally centered, 3 = right aligned. Alignment has no effect if the arrangement's width is automatic.
AlignVertical
A number that encodes how the contents of the arrangement are aligned vertically. The choices are: 1 = aligned at the top, 2 = vertically centered, 3 = aligned at the bottom. Alignment has no effect if the arrangement's height is automatic.
BackgroundColor
Background color for this component
Image
Background image for this component
Visible
If true, component and its contents are visible.
Height
Vertical arrangement height (y-size).
Width
Vertical arrangement width (x-size).

VerticalScrollArrangement

A formatting element in which to place components that should be displayed one below another. (The first child component is stored on top, the second beneath it, etc.) If you wish to have components displayed next to one another, use HorizontalArrangement instead.

This version is scrollable

Properties

AlignHorizontal
A number that encodes how contents of the arrangement are aligned horizontally. The choices are: 1 = left aligned, 2 = right aligned, 3 = horizontally centered. Alignment has no effect if the arrangement's width is automatic.
AlignVertical
A number that encodes how the contents of the arrangement are aligned vertically. The choices are: 1 = aligned at the top, 2 = aligned at the bottom, 3 = vertically centered. Alignment has no effect if the arrangement's height is automatic.
BackgroundColor
Returns the component's background color
Height
HeightPercent
Image
Specifies the path of the component's image. If there is both an Image and a BackgroundColor, only the Image will be visible.
Visible
Specifies whether the component should be visible on the screen. Value is true if the component is showing and false if hidden.
Width
WidthPercent