Constraints

constraints are set on components to hint to the layout manager how to position the component within the layout.

Some constraints are specific to certain layouts, e.g. region for the border layout, and other constraints are to further refine how a component is positioned withing the allocated space within the layout.

Properties

region
ENUM
Required for border layout

Used by the border layout to position the view.

Value Description
"top" Position in the top region, with full width
"right" Position in the right region, with remaining height
"bottom" Position in the bottom region, with full width
"left" Position in the left region, with remaining height
"centre" Position in the centre with remaining width and height
position
ENUM
Default: "fit"

How to position a component within the allotted space.

Value Description
"fit" Fit the component wihtin the allotted space, this usually means filling the entire space.
"centre" Centre the component within the alloted space.
"top" Align the component to the top of the allotted space.
"right" Align the component to the right of the allotted space.
"bottom" Align the component to the bottom of the allotted space.
"left" Align the component to the left of the allotted space.
"topright" Align the component to the top right of the allotted space.
"bottomright" Align the component to the bottom right of the allotted space.
"bottomleft" Align the component to the bottom left of the allotted space.
"topleft" Align the component to the top left of the allotted space.
stretch
ENUM
Default: "none"

How to stretch a component whose position is not fit.

Value Description
"none" Do not stretch.
"horizontal" Stretch to the left and right of abailab space.
"vertical" Stretch to the top and bottom of allotted space.
grid
OBJECT
Required for flex layout

Properties used by the flex layout, allowing a significant amount of flexibility.

col
INTEGER
Default: 0, Range: 0-1024

The column position within the grid.

row
INTEGER
Default: 0, Range: 0-1024

The row position within the grid.

colspan
INTEGER
Default: 1, Range: 1-1024

How many columns to span within the grid.

rowspan
INTEGER
Default: 1, Range: 1-1024

How many rows to span within the grid.

colweight
DOUBLE
Default: 0.0, Range: 0.0-1.0

How much weight this column has during resize, range 0.0 - 1.0. If colspan is more than 1, the weight is shared amongs columns.

rowweight
DOUBLE
Default: 0.0, Range: 0.0-1.0

How much weight this row has during resize, range 0.0 - 1.0. If rowspan is more than 1, the weight is shared amongs rows.

insets
OBJECT

Insets added around this component. These also add to the overall calculated size of the component.

top
INTEGER
Default: 0, Range: 0-128

Top insets in pixels.

right
INTEGER
Default: 0, Range: 0-128

Right insets in pixels.

bottom
INTEGER
Default: 0, Range: 0-128

Bottom insets in pixels.

left
INTEGER
Default: 0, Range: 0-128

Left insets in pixels.

size
OBJECT | INTEGER

Override the default desired size for this component.

When setting size to an integer, both width and height will be set.

width
INTEGER
Default: 0, use 0 for automatic sizing.

The width of the component.

height
INTEGER
Default: 0, use 0 for automatic sizing.

The height of the component.