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

RowScope

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

Scope for the children of Row.

Summary

Public methods

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

A scoped modifier within a Row that sets the horizontal weight of the layout.

ParentDataModifier

A layout modifier within a Row that positions its target component vertically according to the specified HorizontalAlignmentLine, such that the position of the alignment line coincides horizontally 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 Row that positions its target component relative to all other elements within the parent that have LayoutGravity.RelativeToSiblings.

Modifier

Position the element vertically 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 vertically 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 vertically within the Row according to align.

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

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

Properties

ParentDataModifier

A layout modifier within a Row that positions target component vertically such that its bottom edge is aligned to the bottom edge of the Row.

ParentDataModifier

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

ParentDataModifier

A layout modifier within a Row that positions its target component vertically such that its top edge is aligned to the top edge of the Row.

Public methods

LayoutWeight

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

Deprecated.

A scoped modifier within a Row that sets the horizontal weight of the layout. A Row 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 Row, 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.SimpleRow

RelativeToSiblings

fun LayoutGravity.RelativeToSiblings(alignmentLine: HorizontalAlignmentLine): ParentDataModifier

Deprecated.

A layout modifier within a Row that positions its target component vertically according to the specified HorizontalAlignmentLine, such that the position of the alignment line coincides horizontally with the alignment lines of all other siblings having their gravity set to LayoutGravity.RelativeToSiblings. Within a Row, all components with LayoutGravity.RelativeToSiblings will align vertically 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.Top in Row, 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.Top.

Example usage:


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

RelativeToSiblings

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

Deprecated.

A layout modifier within a Row that positions its target component relative to all other elements within the parent that have LayoutGravity.RelativeToSiblings. The alignmentLineBlock accepts the Placeable of the targeted layout and returns the horizontal position along which the target should align such that it coincides vertically with the alignment lines of all other siblings with LayoutGravity.RelativeToSiblings. Within a Row, all components with LayoutGravity.RelativeToSiblings will align vertically 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 if it had LayoutGravity.Top, 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 vertically using LayoutGravity.Top inside the Row.

Example usage:


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

alignWithSiblings

fun Modifier.alignWithSiblings(alignmentLine: HorizontalAlignmentLine): Modifier

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

Example usage:


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

alignWithSiblings

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

Position the element vertically 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: RowAlign): Modifier

Position the element vertically within the Row according to align.

weight

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

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

Properties

Bottom

val LayoutGravity.Bottom: ParentDataModifier

Deprecated.

A layout modifier within a Row that positions target component vertically such that its bottom edge is aligned to the bottom edge of the Row.

Center

val LayoutGravity.Center: ParentDataModifier

Deprecated.

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

Top

val LayoutGravity.Top: ParentDataModifier

Deprecated.

A layout modifier within a Row that positions its target component vertically such that its top edge is aligned to the top edge of the Row.