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

LazyStaggeredGridLayoutInfo

public sealed interface LazyStaggeredGridLayoutInfo


Information about layout state of lazy staggered grids. Can be retrieved from LazyStaggeredGridState.layoutInfo.

Summary

Public methods

abstract int

Content padding in pixels applied after the items in scroll direction.

abstract int

Content padding in pixels applied before the items in scroll direction.

abstract int

The spacing between items in scroll direction.

abstract @NonNull Orientation

Orientation of the staggered grid.

abstract int

The total count of items passed to staggered grid.

abstract int

The end offset of the layout's viewport in pixels.

abstract @NonNull IntSize

Layout viewport (content + content padding) size in pixels.

abstract int

The start offset of the layout's viewport in pixels.

abstract @NonNull List<@NonNull LazyStaggeredGridItemInfo>

The list of LazyStaggeredGridItemInfo per each visible item ordered by index.

Public methods

getAfterContentPadding

abstract int getAfterContentPadding()

Content padding in pixels applied after the items in scroll direction.

getBeforeContentPadding

abstract int getBeforeContentPadding()

Content padding in pixels applied before the items in scroll direction.

getMainAxisItemSpacing

abstract int getMainAxisItemSpacing()

The spacing between items in scroll direction.

getOrientation

abstract @NonNull Orientation getOrientation()

Orientation of the staggered grid.

getTotalItemsCount

abstract int getTotalItemsCount()

The total count of items passed to staggered grid.

getViewportEndOffset

abstract int getViewportEndOffset()

The end offset of the layout's viewport in pixels. You can think of it as a maximum offset which would be visible. It is the size of the lazy grid layout minus beforeContentPadding.

You can use it to understand what items from visibleItemsInfo are fully visible.

getViewportSize

abstract @NonNull IntSize getViewportSize()

Layout viewport (content + content padding) size in pixels.

getViewportStartOffset

abstract int getViewportStartOffset()

The start offset of the layout's viewport in pixels. You can think of it as a minimum offset which would be visible. Can be negative if non-zero beforeContentPadding was applied as the content displayed in the content padding area is still visible.

You can use it to understand what items from visibleItemsInfo are fully visible.

getVisibleItemsInfo

abstract @NonNull List<@NonNull LazyStaggeredGridItemInfogetVisibleItemsInfo()

The list of LazyStaggeredGridItemInfo per each visible item ordered by index.