RowScope

class RowScope : FlexScope
kotlin.Any
   ↳ androidx.ui.layout.FlexScope
   ↳ androidx.ui.layout.RowScope

A RowScope provides a scope for the children of a Row.

Summary

Public methods

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 with the alignment lines of all other siblings having their gravity set to LayoutGravity.RelativeToSiblings.

Inherited functions

Inherited extension functions

From androidx.compose
operator T

IMPORTANT: This global operator is TEMPORARY, and should be removed whenever an answer for contextual composers is reached.

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

RelativeToSiblings

fun LayoutGravity.RelativeToSiblings(alignmentLine: HorizontalAlignmentLine): 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 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:

import androidx.ui.core.Text
import androidx.ui.layout.Container
import androidx.ui.layout.Row
import androidx.ui.text.TextStyle

Row(LayoutHeight.Fill) {
    // Center of the colored rectangle is aligned to first baseline of the text.
    SizedRectangle(
        color = Color.Red,
        width = 80.dp,
        height = 40.dp,
        modifier = LayoutGravity.RelativeToSiblings { it.height * 0.5 }
    )
    Container(width = 80.dp, modifier = LayoutGravity.RelativeToSiblings(FirstBaseline)) {
        Text(text = "Text.", style = TextStyle(background = Color.Cyan))
    }
}

Properties

Bottom

val LayoutGravity.Bottom: 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.

Center

val LayoutGravity.Center: ParentDataModifier

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

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.