Titanium中布局类Titanium.UI.Window.layout
Titanium.UI.Window.layoutProperty of Titanium.UI.Window. Inherited from Titanium.UI.View. PlatformSinceAndroid0.9iPhone0.9iPad0.9Mobile Web1.8Permission: read-writeSummary
Specifies how the view positions its children. One of: 'absolute', 'vertical', or 'horizontal'.
TypeStringDefaultabsolute layout
DescriptionThere are three layout options:
absolute
. Default layout. A child view's top
, bottom
, left
, and right
properties are interpreted as absolute values in the parent's coordinate space.
If the child includes a top
value and not a bottom
value, the child is positioned top
units from the top of the parent's bounding box, and its height is set based on its height
property.
If the child includes a bottom
value and not a top
value, the child is positioned bottom
units from the bottom of the parent's bounding box. Its height is set based on its height
property.
If the child includes both top
and bottom
values, the behavior is platform-specific.
Similar calculations are used for left
and right
.
You can also position a child by setting its center
property to a Point
.
If no position is set explicitly, children are centered. For example, if a child specifies a top
of 20 and does not specify any other position properties, the child is positioned 20 units from the parent's top, and centered horizontally.
vertical
. Children are laid out vertically from top to bottom. The first child is laid out top
units from its parent's bounding box. Each subsequent child is laid out below the previous child. The space between children is equal to the upper child's bottom
value plus the lower child's top
value.
Each child is positioned horizontally as for the absolute layout mode.
horizontal
. Like vertical layout, except children are laid out horizontally from left to right, using the left
and right
values to determine spacing.
Each child is positioned vertically as in the absolute layout mode.