# LazyLayoutMeasureScope

Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/lazy/layout/LazyLayoutMeasureScope.kt+class:androidx.compose.foundation.lazy.layout.LazyLayoutMeasureScope) Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.2.0) Common/AllAndroid/JVM
- Cmn

  ```
  sealed interface LazyLayoutMeasureScope : MeasureScope
  ```

*** ** * ** ***

The receiver scope of a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayout.composable#LazyLayout(kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.foundation.lazy.layout.LazyLayoutPrefetchState,androidx.compose.foundation.lazy.layout.LazyLayoutMeasurePolicy)`'s measure lambda. The return value of the measure lambda is `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/MeasureResult`, which should be returned by `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/MeasureScope#layout(kotlin.Int,kotlin.Int,kotlin.collections.Map,kotlin.Function1)`.

Call `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutMeasureScope#compose(kotlin.Int)` to compose items emitted in a content block for a given index.

## Summary

| ### Public functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/Measurable>` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutMeasureScope#compose(kotlin.Int)(index: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Compose an item of lazy layout. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/Placeable>` | `@https://developer.android.com/reference/kotlin/androidx/compose/foundation/ExperimentalFoundationApi [measure](https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutMeasureScope#measure(kotlin.Int,androidx.compose.ui.unit.Constraints))(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, constraints: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints)` **This function is deprecated.** Please use compose and call Measurable.measure | Cmn |

### Inherited functions

From [androidx.compose.ui.unit.Density](https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density) `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density#(androidx.compose.ui.unit.Dp).roundToPx()()`

Convert `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` to `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` by rounding
Cmn `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/TextUnit.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density#(androidx.compose.ui.unit.TextUnit).roundToPx()()`

Convert Sp to `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` by rounding
Cmn `open https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density#(kotlin.Int).toDp()()`

Convert an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` pixel value to `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp`.
Cmn `open https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density#(kotlin.Float).toDp()()`

Convert a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` pixel value to a Dp
Cmn `open https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize` `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Size.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density#(androidx.compose.ui.geometry.Size).toDpSize()()`

Convert a `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Size` to a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize`.
Cmn `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density#(androidx.compose.ui.unit.Dp).toPx()()`

Convert `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` to pixels.
Cmn `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/TextUnit.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density#(androidx.compose.ui.unit.TextUnit).toPx()()`

Convert Sp to pixels.
Cmn `open https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Rect` `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpRect.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density#(androidx.compose.ui.unit.DpRect).toRect()()`

Convert a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpRect` to a `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Rect`.
Cmn `open https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Size` `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density#(androidx.compose.ui.unit.DpSize).toSize()()`

Convert a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize` to a `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Size`.
Cmn `open https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/TextUnit` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density#(kotlin.Int).toSp()()`

Convert an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` pixel value to Sp.
Cmn `open https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/TextUnit` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density#(kotlin.Float).toSp()()`

Convert a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` pixel value to a Sp
Cmn From [androidx.compose.ui.unit.FontScaling](https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/FontScaling) `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/TextUnit.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/FontScaling#(androidx.compose.ui.unit.TextUnit).toDp()()`

Convert Sp to `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp`.
Cmn `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/TextUnit` `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/FontScaling#(androidx.compose.ui.unit.Dp).toSp()()`

Convert `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` to Sp.
Cmn From [androidx.compose.ui.layout.MeasureScope](https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/MeasureScope) `open https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/MeasureResult` `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/MeasureScope#layout(kotlin.Int,kotlin.Int,kotlin.collections.Map,kotlin.Function1)(
width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html,
height: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html,
alignmentLines: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/AlignmentLine, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>,
placementBlock: https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/Placeable.PlacementScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html
)`

Sets the size and alignment lines of the measured layout, as well as the positioning block that defines the children positioning logic.
Cmn `open https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/MeasureResult` `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/MeasureScope#layout(kotlin.Int,kotlin.Int,kotlin.collections.Map,kotlin.Function1,kotlin.Function1)(
width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html,
height: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html,
alignmentLines: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/AlignmentLine, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>,
rulers: (https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/RulerScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?,
placementBlock: https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/Placeable.PlacementScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html
)`

Sets the size and alignment lines of the measured layout, as well as the positioning block that defines the children positioning logic.
Cmn `open https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/MeasureResult` `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/MeasureScope#layout(kotlin.Int,kotlin.Int,kotlin.Function1,kotlin.Function2,kotlin.collections.Map,kotlin.Function1)(
width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html,
height: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html,
isRulerProvided: (https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/Ruler) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html,
rulerProvider: https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/RulerScope.(https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/Ruler) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html,
alignmentLines: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/AlignmentLine, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>,
placementBlock: https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/Placeable.PlacementScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html
)`

Sets the size and alignment lines of the measured layout, as well as the positioning block that defines the children positioning logic.
Cmn

### Inherited properties

From [androidx.compose.ui.unit.Density](https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density#density()`

The logical density of the display.
Cmn From [androidx.compose.ui.unit.FontScaling](https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/FontScaling) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/FontScaling#fontScale()`

Current user preference for the scaling factor for fonts.
Cmn From [androidx.compose.ui.layout.IntrinsicMeasureScope](https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/IntrinsicMeasureScope) `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/IntrinsicMeasureScope#isLookingAhead()`

This indicates whether the ongoing measurement is for lookahead pass.
Cmn `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/LayoutDirection` `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/IntrinsicMeasureScope#layoutDirection()`

The `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/LayoutDirection` of the `Layout` or `LayoutModifier` using the measure scope to measure their children.
Cmn

## Public functions

### compose

Cmn Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.9.0)

```
fun compose(index: @IntRange(from = 0) Int): List<Measurable>
```

Compose an item of lazy layout.

| Parameters |
|---|---|
| `index: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the item index. Should be no larger that `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutItemProvider#itemCount()`. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/Measurable>` | List of `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/Measurable`s. Note that if you emitted multiple children into the item composable you will receive multiple measurebles. |

### measure

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.10.0) Deprecated in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.10.0)

```
@ExperimentalFoundationApi
fun [measure](https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutMeasureScope#measure(kotlin.Int,androidx.compose.ui.unit.Constraints))(index: Int, constraints: Constraints): List<Placeable>
```

> [!CAUTION]
> **This function is deprecated.**   
> Please use compose and call Measurable.measure, use this instead:
>
> ```kotlin
> compose(index).map { it.measure(constraints) }
> ```

Subcompose and measure the item of lazy layout.

| Parameters |
|---|---|
| `index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the item index. Should be no larger that `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutItemProvider#itemCount()`. |
| `constraints: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints` to measure the children emitted into an item content composable specified via `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutItemProvider#Item(kotlin.Int,kotlin.Any)`. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/Placeable>` | List of `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/Placeable`s. Note that if you emitted multiple children into the item composable you will receive multiple placeables, each of them will be measured with the passed `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutMeasureScope#measure(kotlin.Int,androidx.compose.ui.unit.Constraints)`. |