added in version 22.1.0
belongs to Maven artifact com.android.support:recyclerview-v7:28.0.0-alpha1

StaggeredGridLayoutManager

public class StaggeredGridLayoutManager
extends RecyclerView.LayoutManager implements RecyclerView.SmoothScroller.ScrollVectorProvider

java.lang.Object
   ↳ android.support.v7.widget.RecyclerView.LayoutManager
     ↳ android.support.v7.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

class StaggeredGridLayoutManager.LayoutParams

LayoutParams used by StaggeredGridLayoutManager. 

Inherited XML attributes

From class android.support.v7.widget.RecyclerView.LayoutManager

Constants

int GAP_HANDLING_LAZY

This constant was deprecated in API level 22.1.0. No longer supported.

int GAP_HANDLING_MOVE_ITEMS_BETWEEN_SPANS

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

int GAP_HANDLING_NONE

Does not do anything to hide gaps.

int HORIZONTAL

int VERTICAL

Public constructors

StaggeredGridLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)

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

StaggeredGridLayoutManager(int spanCount, int orientation)

Creates a StaggeredGridLayoutManager with given parameters.

Public methods

void assertNotInLayoutOrScroll(String message)

Checks if RecyclerView is in the middle of a layout or scroll and throws an IllegalStateException if it is.

boolean canScrollHorizontally()

Query if horizontal scrolling is currently supported.

boolean canScrollVertically()

Query if vertical scrolling is currently supported.

boolean checkLayoutParams(RecyclerView.LayoutParams lp)

Determines the validity of the supplied LayoutParams object.

int computeHorizontalScrollExtent(RecyclerView.State state)

Override this method if you want to support scroll bars.

int computeHorizontalScrollOffset(RecyclerView.State state)

Override this method if you want to support scroll bars.

int computeHorizontalScrollRange(RecyclerView.State state)

Override this method if you want to support scroll bars.

PointF