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
borderlayout
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
flexlayout
- insets
- OBJECT
Insets added around this component. These also add to the overall calculated size of the component.