{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

IntermediateMeasureScope

@ExperimentalComposeUiApi
public sealed interface IntermediateMeasureScope extends LookaheadScope, MeasureScope


IntermediateMeasureScope provides access to lookahead results to allow intermediateLayout to leverage lookahead results to define intermediate measurements and placements to gradually converge with lookahead.

IntermediateMeasureScope.lookaheadSize provides the target size of the layout. IntermediateMeasureScope is also a LookaheadScope, thus allowing layouts to read their LookaheadLayoutCoordinates during placement using LookaheadScope.toLookaheadCoordinates, as well as the LookaheadLayoutCoordinates of the closest lookahead scope via LookaheadScope.lookaheadScopeCoordinates. By knowing the target size and position, layout adjustments such as animations can be defined in intermediateLayout to morph the layout gradually in both size and position to arrive at its precalculated bounds.

Note that IntermediateMeasureScope is the closest lookahead scope in the tree. This LookaheadScope enables convenient query of the layout's relative position to the LookaheadScope. Hence it becomes straightforward to animate position relative to the closest scope, which usually yields a natural looking animation, unless there are specific UX requirements to change position relative to a particular LookaheadScope.

IntermediateMeasureScope is a CoroutineScope, as a convenient scope for all the coroutine-based intermediate changes (e.g. animations) to be launched from.

Summary

Public methods

abstract @NonNull IntSize

Indicates the target size of the intermediateLayout.

Inherited methods

From androidx.compose.ui.unit.Density
abstract float

The logical density of the display.

abstract float

Current user preference for the scaling factor for fonts.

default int

Convert Dp to Int by rounding

default int

Convert Sp to Int by rounding

default @NonNull Dp

Convert Sp to Dp.

default @NonNull Dp
orgKt.toDp(int receiver)

Convert an Int pixel value to Dp.

default @NonNull Dp
orgKt.toDp(float receiver)

Convert a Float pixel value to a Dp

default @NonNull DpSize

Convert a Size to a DpSize.

default float
orgKt.toPx(@NonNull Dp receiver)

Convert Dp to pixels.

default float

Convert Sp to pixels.

default @NonNull Rect

Convert a DpRect to a Rect.

default @NonNull Size

Convert a DpSize to a Size.

default @NonNull TextUnit
orgKt.toSp(@NonNull Dp receiver)

Convert Dp to Sp.

default @NonNull TextUnit
orgKt.toSp(int receiver)

Convert an Int pixel value to Sp.

default @NonNull TextUnit
orgKt.toSp(float receiver)

Convert a Float pixel value to a Sp

From androidx.compose.ui.layout.IntrinsicMeasureScope
abstract @NonNull LayoutDirection

The LayoutDirection of the Layout or LayoutModifier using the measure scope to measure their children.

default boolean

This indicates whether the ongoing measurement is for lookahead pass.

From androidx.compose.ui.layout.LookaheadScope
abstract @NonNull LayoutCoordinates

Returns the LayoutCoordinates of the LookaheadScope.

default @NonNull Modifier

This method is deprecated.

default @NonNull Offset

Calculates the localPosition in the Lookahead coordinate space.

abstract @NonNull Modifier

This method is deprecated. onPlaced in LookaheadLayoutScope has been deprecated.

abstract @NonNull LayoutCoordinates

Converts a LayoutCoordinates into a LayoutCoordinates in the Lookahead coordinates space.

From androidx.compose.ui.layout.MeasureScope
default @NonNull MeasureResult
layout(
    int width,
    int height,
    @NonNull Map<@NonNull AlignmentLine, @NonNull Integer> alignmentLines,
    @ExtensionFunctionType @NonNull Function1<@NonNull Placeable.PlacementScopeUnit> placementBlock
)

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

Public methods

getLookaheadSize

abstract @NonNull IntSize getLookaheadSize()

Indicates the target size of the intermediateLayout.