ColumnScope
@LayoutScopeMarker
@JvmDefaultWithCompatibility
interface ColumnScope
Scope for the children of Column
.
Functions
fun Modifier.weight(
@FloatRange(from = 0.0, fromInclusive = false) 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. When fill
is true,
the element will be forced to occupy the whole height allocated to it. Otherwise, the element
is allowed to be smaller - this will result in Column
being smaller, as the unused
allocated height will not be redistributed to other siblings.
In a FlowColumn
, when a weight is applied to an item, the item is scaled based on the
number of weighted items that fall on the column it was placed in.
Parameters
weight | The proportional height 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 height allocated. |
fun Modifier.align(alignment: Alignment.Horizontal): Modifier
Align the element horizontally within the Column
. This alignment will have priority over
the Column
's horizontalAlignment
parameter.
fun Modifier.alignBy(alignmentLine: VerticalAlignmentLine): Modifier
Position the element horizontally 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. Within a Column
, all components with alignBy
will align horizontally using the specified VerticalAlignmentLine
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.Start
align in Column
, 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 Column
has the alignBy
modifier specified the element will be
positioned as if it had Alignment.Start
align.
fun Modifier.alignBy(alignmentLineBlock: (Measured) -> Int): Modifier
Position the element horizontally 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 Column
, all components with alignBy
will align horizontally using the
specified VerticalAlignmentLine
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.Start
align in Column
, 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
Column
has the alignBy
modifier specified the element will be positioned as if it had
Alignment.Start
align.