Layout
@Composable
inline fun Layout(
content: @Composable @UiComposable () -> Unit,
modifier: Modifier = Modifier,
measurePolicy: MeasurePolicy,
)
Layout is the main core component for layout. It can be used to measure and position zero or more layout children.
The measurement, layout and intrinsic measurement behaviours of this layout will be defined by the measurePolicy instance. See MeasurePolicy for more details.
For a composable able to define its content according to the incoming constraints, see androidx.compose.foundation.layout.BoxWithConstraints.
Example usage with custom intrinsic measurements:
Parameters
| content | The children composable to be laid out. |
| modifier | Modifiers to be applied to the layout. |
| measurePolicy | The policy defining the measurement and positioning of the layout. |
Layout
@Composable
inline fun Layout(modifier: Modifier = Modifier, measurePolicy: MeasurePolicy)
Layout is the main core component for layout for "leaf" nodes. It can be used to measure and position zero children.
The measurement, layout and intrinsic measurement behaviours of this layout will be defined by the measurePolicy instance. See MeasurePolicy for more details.
For a composable able to define its content according to the incoming constraints, see androidx.compose.foundation.layout.BoxWithConstraints.
Example usage with custom intrinsic measurements:
Parameters
| modifier | Modifiers to be applied to the layout. |
| measurePolicy | The policy defining the measurement and positioning of the layout. |
Layout
@Composable
inline fun Layout(
contents: List<@Composable @UiComposable () -> Unit>,
modifier: Modifier = Modifier,
measurePolicy: MultiContentMeasurePolicy,
)
Layout is the main core component for layout. It can be used to measure and position zero or more layout children.
This overload accepts a list of multiple composable content lambdas, which allows treating measurables put into different content lambdas differently - measure policy will provide a list of lists of Measurables, not just a single list. Such list has the same size as the list of contents passed into Layout and contains the list of measurables of the corresponding content lambda in the same order.
Note that layouts emitted as part of all contents lambdas will be added as a direct children for this Layout. This means that if you set a custom z index on some children, the drawing order will be calculated as if they were all provided as part of one lambda.
Parameters
| contents | The list of children composable contents to be laid out. |
| modifier | Modifiers to be applied to the layout. |
| measurePolicy | The policy defining the measurement and positioning of the layout. |