The second Android 11 Developer Preview is now available, test it out and share your feedback.

ColumnScope

object ColumnScope
kotlin.Any
   ↳ androidx.ui.layout.ColumnScope

Scope for the children of Column.

Summary

Public methods

ParentDataModifier
LayoutWeight(weight: Float, fill: Boolean = true)

A scoped modifier within a Column that sets the vertical weight of the layout.

ParentDataModifier

A layout modifier within a Column that positions its target component horizontally according to the specified VerticalAlignmentLine, such that the position of the alignment line coincides vertically with the alignment lines of all other siblings having their gravity set to LayoutGravity.RelativeToSiblings.

ParentDataModifier
LayoutGravity.RelativeToSiblings(alignmentLineBlock: (Placeable) -> IntPx)

A layout modifier within a Column that positions its target component relative to all other elements within the container which have LayoutGravity.RelativeToSiblings.

Modifier

Position the element horizontally such that its alignmentLine aligns with sibling elements also configured to alignWithSiblings with the same alignmentLine.

Modifier
Modifier.alignWithSiblings(alignmentLineBlock: (Placeable) -> IntPx)

Position the element horizontally such that the alignment line for the content as determined by alignmentLineBlock aligns with sibling elements also configured to alignWithSiblings with an alignmentLineBlock.

Modifier

Position the element horizontally within the Column according to align.

Modifier
Modifier.weight(weight: Float, fill: Boolean = true)

Size the element's height proportional to its weight relative to other weighted sibling elements in the Column.

Properties

ParentDataModifier

A layout modifier within a Column that positions its target component horizontally such that its center is in the middle of the Column.

ParentDataModifier

A layout modifier within a Column that positions its target component horizontally such that its end edge is aligned to the end edge of the Column.

ParentDataModifier

A layout modifier within a Column that positions its target component horizontally such that its start edge is aligned to the start edge of the Column.

Public methods

LayoutWeight

fun LayoutWeight(
    weight: Float,
    fill: Boolean = true
): ParentDataModifier

Deprecated.

A scoped modifier within a Column that sets the vertical weight of the layout. A Column child that has a weight will be assigned a space proportional to its weight, relative to the other siblings that have weights. This will be calculated by dividing the remaining space after all the siblings without weights will have chosen their size. Note that LayoutWeight will only work when applied to layouts that are direct children of Column, as these are the only parent layouts that know how to interpret its significance. Also, the position of LayoutWeight within a modifier chain is not important, as it will just act as data for the parent layout, which will know to measure the child according to its weight. If more than one LayoutWeight is provided in a modifier chain, the outermost (leftmost) one will be used. When fill is set to true, the layout is forced to occupy the entire space assigned to it by the parent.


//Unresolved: androidx.ui.layout.samples.SimpleColumn

RelativeToSiblings

fun LayoutGravity.RelativeToSiblings(alignmentLine: VerticalAlignmentLine): ParentDataModifier

Deprecated.

A layout modifier within a Column that positions its target component horizontally according to the specified VerticalAlignmentLine, such that the position of the alignment line coincides vertically with the alignment lines of all other siblings having their gravity set to LayoutGravity.RelativeToSiblings. Within a Column, all components with LayoutGravity.RelativeToSiblings will align horizontally using the specified AlignmentLines or values obtained from alignmentLineBlocks, forming a sibling group. At least one element of the sibling group will be placed as it had ColumnScope.Start in Column, and the alignment of the other siblings will be then determined such that the alignment lines coincide. Note that if the target component is the only one with the RelativeToSiblings modifier specified, then the component will be positioned using LayoutGravity.Start.

Example usage:


//Unresolved: androidx.ui.layout.samples.SimpleRelativeToSiblingsInColumn

RelativeToSiblings

fun LayoutGravity.RelativeToSiblings(alignmentLineBlock: (Placeable) -> IntPx): ParentDataModifier

Deprecated.

A layout modifier within a Column that positions its target component relative to all other elements within the container which have LayoutGravity.RelativeToSiblings. The alignmentLineBlock accepts the Placeable of the targeted layout and returns the vertical position along which the target should align such that it coincides horizontally with the alignment lines of all other siblings with LayoutGravity.RelativeToSiblings. Within a Column, all components with LayoutGravity.RelativeToSiblings will align horizontally using the specified AlignmentLines or values obtained from alignmentLineBlocks, forming a sibling group. At least one element of the sibling group will be placed as it had LayoutGravity.Start, and the alignment of the other siblings will be then determined such that the alignment lines coincide. Note that if the target component is the only one with the RelativeToSiblings modifier specified, then the component will be positioned horizontally using LayoutGravity.Start inside the Column.

Example usage:


//Unresolved: androidx.ui.layout.samples.SimpleRelativeToSiblings

alignWithSiblings

fun Modifier.alignWithSiblings(alignmentLine: VerticalAlignmentLine): Modifier

Position the element horizontally such that its alignmentLine aligns with sibling elements also configured to alignWithSiblings with the same alignmentLine.

Example usage:


//Unresolved: androidx.ui.layout.samples.SimpleRelativeToSiblingsInColumn

alignWithSiblings

fun Modifier.alignWithSiblings(alignmentLineBlock: (Placeable) -> IntPx): Modifier

Position the element horizontally such that the alignment line for the content as determined by alignmentLineBlock aligns with sibling elements also configured to alignWithSiblings with an alignmentLineBlock.

Example usage:


//Unresolved: androidx.ui.layout.samples.SimpleRelativeToSiblings

gravity

fun Modifier.gravity(align: ColumnAlign): Modifier

Position the element horizontally within the Column according to align.

weight

fun Modifier.weight(
    weight: Float,
    fill: Boolean = true
): Modifier

Size the element's height proportional to its weight relative to other weighted sibling elements in the Column. The parent will divide the vertical space remaining after measuring unweighted child elements and distribute it according to this weight.


//Unresolved: androidx.ui.layout.samples.SimpleColumn

Properties

Center

val LayoutGravity.Center: ParentDataModifier

Deprecated.

A layout modifier within a Column that positions its target component horizontally such that its center is in the middle of the Column.

End

val LayoutGravity.End: ParentDataModifier

Deprecated.

A layout modifier within a Column that positions its target component horizontally such that its end edge is aligned to the end edge of the Column.

Start

val LayoutGravity.Start: ParentDataModifier

Deprecated.

A layout modifier within a Column that positions its target component horizontally such that its start edge is aligned to the start edge of the Column.