ListLayout

ListLayout is a container that implements the ViewsContainer interface. To create it, use the function

func NewListLayout(session Session, params Params) ListLayout

Items in this container are arranged as a list. The position of the children can be controlled.For this, ListLayout has a number of properties

"orientation" property

The "orientation" int property (Orientation constant) specifies how the children will be positionedrelative to each other. The property can take the following values:

Value Constant Location
0 TopDownOrientation Child elements are arranged in a column from top to bottom.
1 StartToEndOrientation Child elements are laid out in a row from beginning to end.
2 BottomUpOrientation Child elements are arranged in a column from bottom to top.
3 EndToStartOrientation Child elements are laid out in a line from end to beginning.

The start and end positions for StartToEndOrientation and EndToStartOrientation depend on the valueof the "text-direction" property. For languages written from right to left (Arabic, Hebrew),the beginning is on the right, for other languages - on the left.

"list-wrap" property

The "list-wrap" int property (ListWrap constant) defines the position of elements in case of reachingthe border of the container. There are three options:

  • ListWrapOff (0) - the column / row of elements continues and goes beyond the bounds of the visible area.
  • ListWrapOn (1) - starts a new column / row of items. The new column is positioned towards the end(for the position of the beginning and end, see above), the new line is at the bottom.
  • ListWrapReverse (2) - starts a new column / row of elements. The new column is positioned towards the beginning(for the position of the beginning and end, see above), the new line is at the top.

"vertical-align" property

The "vertical-align" property (VerticalAlign constant) of type int sets the verticalalignment of items in the container. Valid values:

Value Constant Name Alignment
0 TopAlign "top" Top alignment
1 BottomAlign "bottom" Bottom alignment
2 CenterAlign "center" Center alignment
3 StretchAlign "stretch" Height alignment

"horizontal-align" property

The "horizontal-align" int property (HorizontalAlign constant) sets the horizontalalignment of items in the list. Valid values:

Value Constant Name Alignment
0 LeftAlign "left" Left alignment
1 RightAlign "right" Right alignment
2 CenterAlign "center" Center alignment
3 StretchAlign "stretch" Width alignment

"list-row-gap" and "list-column-gap" properties

The "list-row-gap" and "list-column-gap" SizeUnit properties (ListRowGap and ListColumnGap constants)allow you to set the distance between the rows and columns of the container, respectively. The default is 0px.

"order"

The "order" property (Order constant) of type int is used by Views placed in a ListLayout or GridLayout container (see below),to change its position in the container.The "order" property defines the order used to place the View in the container. The elements are arranged in ascending order by their order value.Elements with the same order value are placed in the order in which they were added to the container.

The default value is 0. Therefore, negative values of the "order" property must be used to place the View at the beginning.

Note: The "order" property only affects the visual order of the elements, not the logical order or tabs.