
CHAPTER 4: User-Interface Tools Automatic layout 90
You can override the container’s child alignment, as specified by alignChildren, by setting the
alignment property of a particular child element. The following diagram shows the result of setting
alignment to right for the EditText element, when the parent’s alignChildren value is left:
Alignment in two dimensions
You can set the alignment property with a two-string array instead of a single string, where the first string
is the horizontal alignment and the second is the vertical alignment. This allows you to control the
horizontal placement of children in a container with row orientation, and the vertical placement of
children in a container with column orientation.
The following figures show the results of the sample script
SnpAlignElements.jsx, that demonstrates
how to specify alignment in two dimensions.
X In the first, each control is centered vertically within its row, and placed at a specific horizontal
position, using an alignment value such as
['left', 'center'] for each element:
X The vertical alignment example creates four columns, and places the controls within each column
along the vertical axis. It uses alignment values such as
['fill', 'top'] to distribute controls within
the column, while still controlling the relative vertical positions:
Comentários a estes Manuais