The Android Developer Challenge is back! Submit your idea before December 2.

StackChildren

class StackChildren
kotlin.Any
   ↳ androidx.ui.layout.StackChildren

Collects information about the children of a Stack when its body is executed with a StackChildren instance as argument.

Summary

Public constructors

Collects information about the children of a Stack when its body is executed with a StackChildren instance as argument.

Public methods

Unit
aligned(alignment: Alignment, loose: Boolean = true, children: () -> Unit)

Aligned children determine the size of the Stack and are aligned within the box of the Stack according to the specified alignment.

Unit
expanded(children: () -> Unit)

Expanded children are forced to expand to fill the box of the Stack.

Unit
positioned(leftInset: Dp? = null, topInset: Dp? = null, rightInset: Dp? = null, bottomInset: Dp? = null, fallbackAlignment: Alignment = Alignment.Center, children: () -> Unit)

Positioned children are positioned in the box of the Stack according to the given insets.

Public constructors

<init>

StackChildren()

Collects information about the children of a Stack when its body is executed with a StackChildren instance as argument.

Public methods

aligned

fun aligned(
    alignment: Alignment,
    loose: Boolean = true,
    children: () -> Unit
): Unit

Aligned children determine the size of the Stack and are aligned within the box of the Stack according to the specified alignment.

By default, the constraints passed to the Stack from its parent are loosened before they are passed to its children. To pass these constraints unmodified, set loose to false.

Parameters
loose: Boolean = true: Boolean = true Specifies how the constraints passed to the children are adjusted.

expanded

fun expanded(children: () -> Unit
): Unit

Expanded children are forced to expand to fill the box of the Stack.

positioned

fun positioned(
    leftInset: Dp? = null,
    topInset: Dp? = null,
    rightInset: Dp? = null,
    bottomInset: Dp? = null,
    fallbackAlignment: Alignment = Alignment.Center,
    children: () -> Unit
): Unit

Positioned children are positioned in the box of the Stack according to the given insets.

The insets may be null, but at least one inset must be non-null.

If both insets in a direction (i.e. left-right or top-bottom) are non-null, then the children will be measured with tight constraints in that direction so that they fill all the space in that direction minus the insets. For example, if the Stack is 100dp wide and the children have left and right insets of 10dp, the children will be forced to be 80dp wide.

If only one inset in a direction is non-null, then the children will be measured with loose constraints in that direction. For example, if the Stack is 100dp wide and the children have 10dp left insets, then the children will be anywhere from 0dp to 90dp wide.

Finally, if both insets in one direction are null, then the children will be positioned on that direction according to the specified fallbackAlignment, which defaults to Center.