Google is committed to advancing racial equity for Black communities. See how.

StaggeredGridLayoutManager

open class StaggeredGridLayoutManager : RecyclerView.LayoutManager, RecyclerView.SmoothScroller.ScrollVectorProvider
kotlin.Any
   ↳ androidx.recyclerview.widget.RecyclerView.LayoutManager
   ↳ androidx.recyclerview.widget.StaggeredGridLayoutManager

A LayoutManager that lays out children in a staggered grid formation. It supports horizontal & vertical layout as well as an ability to layout children in reverse.

Staggered grids are likely to have gaps at the edges of the layout. To avoid these gaps, StaggeredGridLayoutManager can offset spans independently or move items between spans. You can control this behavior via setGapStrategy(int).

Summary

Nested classes
open

LayoutParams used by StaggeredGridLayoutManager.

Constants
static Int

static Int

When scroll state is changed to RecyclerView#SCROLL_STATE_IDLE, StaggeredGrid will check if there are gaps in the because of full span items.

static Int

Does not do anything to hide gaps.

static Int

static Int

Public constructors
<init>(context: Context!, attrs: AttributeSet!, defStyleAttr: Int, defStyleRes: Int)

Constructor used when layout manager is set in XML by RecyclerView attribute "layoutManager".

<init>(spanCount: Int, orientation: Int)

Creates a StaggeredGridLayoutManager with given parameters.

Public methods
open Unit

open Boolean

open Boolean

open Boolean

open Int

open Int

open Int

open PointF?

open Int

open Int

open Int

open IntArray!

Returns the adapter position of the first completely visible view for each span.

open IntArray!

Returns the adapter position of the first visible view for each span.

open IntArray!

Returns the adapter position of the last completely visible view for each span.

open IntArray!

Returns the adapter position of the last visible view for each span.

open RecyclerView.LayoutParams!

open RecyclerView.LayoutParams!

open RecyclerView.LayoutParams!

open Int

Returns the current gap handling strategy for StaggeredGridLayoutManager.

open Int

open Boolean

Returns whether views are laid out in reverse order or not.

open Int

Returns the number of spans laid out by StaggeredGridLayoutManager.

open Unit

For consistency, StaggeredGridLayoutManager keeps a mapping between spans and items.

open Boolean

open Unit

open Unit

open Unit

open Unit

open View?
onFocusSearchFailed(focused: View, direction: Int, recycler: RecyclerView.Recycler, state: RecyclerView.State)

open Unit

open Unit
onItemsAdded(recyclerView: RecyclerView, positionStart: Int, itemCount: Int)

open Unit

open Unit
onItemsMoved(recyclerView: RecyclerView, from: Int, to: Int, itemCount: Int)

open Unit
onItemsRemoved(recyclerView: RecyclerView, positionStart: Int, itemCount: Int)

open Unit
onItemsUpdated(recyclerView: RecyclerView, positionStart: Int, itemCount: Int, payload: Any?)

open Unit

open Unit

open Unit

open Parcelable?

open Unit

open Int

open Unit
scrollToPosition(position: Int)

open Unit
scrollToPositionWithOffset(position: Int, offset: Int)

Scroll to the specified adapter position with the given offset from layout start.

open Int

open Unit
setGapStrategy(gapStrategy: Int)

Sets the gap handling strategy for StaggeredGridLayoutManager.

open Unit
setMeasuredDimension(childrenBounds: Rect!, wSpec: Int, hSpec: Int)

open Unit
setOrientation(orientation: Int)

Sets the orientation of the layout.

open Unit
setReverseLayout(reverseLayout: Boolean)

Sets whether LayoutManager should start laying out items from the end of the UI.

open Unit
setSpanCount(spanCount: Int)

Sets the number of spans for the layout.

open Unit
smoothScrollToPosition(recyclerView: RecyclerView!, state: RecyclerView.State!, position: Int)

open Boolean

Inherited functions