RowScope
@LayoutScopeMarker
@JvmDefaultWithCompatibility
interface RowScope
Scope for the children of Row
.
Functions
fun Modifier.weight(
@FloatRange(from = 0.0, fromInclusive = false) 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. When fill
is true,
the element will be forced to occupy the whole width allocated to it. Otherwise, the element
is allowed to be smaller - this will result in Row
being smaller, as the unused allocated
width will not be redistributed to other siblings.
Parameters
weight | The proportional width to give to this element, as related to the total of all weighted siblings. Must be positive. |
fill | When true , the element will occupy the whole width allocated. |
fun Modifier.align(alignment: Alignment.Vertical): Modifier
Align the element vertically within the Row
. This alignment will have priority over the
Row
's verticalAlignment
parameter.
fun Modifier.alignBy(alignmentLine: HorizontalAlignmentLine): Modifier
Position the element vertically such that its alignmentLine
aligns with sibling elements
also configured to alignBy
. alignBy
is a form of align
, so both modifiers will not work
together if specified for the same layout. alignBy
can be used to align two layouts by
baseline inside a Row
, using alignBy(FirstBaseline)
. Within a Row
, all components with
alignBy
will align vertically using the specified HorizontalAlignmentLine
s or values
provided using the other alignBy
overload, forming a sibling group. At least one element of
the sibling group will be placed as it had Alignment.Top
align in Row
, and the alignment
of the other siblings will be then determined such that the alignment lines coincide. Note
that if only one element in a Row
has the alignBy
modifier specified the element will be
positioned as if it had Alignment.Top
align.
fun Modifier.alignByBaseline(): Modifier
Position the element vertically such that its first baseline aligns with sibling elements
also configured to alignByBaseline
or alignBy
. This modifier is a form of align
, so
both modifiers will not work together if specified for the same layout. alignByBaseline
is
a particular case of alignBy
. See alignBy
for more details.
fun Modifier.alignBy(alignmentLineBlock: (Measured) -> Int): Modifier
Position the element vertically such that the alignment line for the content as determined by
alignmentLineBlock
aligns with sibling elements also configured to alignBy
. alignBy
is
a form of align
, so both modifiers will not work together if specified for the same layout.
Within a Row
, all components with alignBy
will align vertically using the specified
HorizontalAlignmentLine
s or values obtained from alignmentLineBlock
, forming a sibling
group. At least one element of the sibling group will be placed as it had Alignment.Top
align in Row
, and the alignment of the other siblings will be then determined such that the
alignment lines coincide. Note that if only one element in a Row
has the alignBy
modifier
specified the element will be positioned as if it had Alignment.Top
align.