GridLayoutManager
A RecyclerView.LayoutManager implementations that lays out items in a grid.
By default, each item occupies 1 span. You can change it by providing a custom SpanSizeLookup instance via setSpanSizeLookup.
Constructors
Types
Link copied to clipboard
Default implementation for SpanSizeLookup.
Link copied to clipboard
LayoutParams used by GridLayoutManager.
Link copied to clipboard
A helper class to provide the number of spans each item occupies.
Functions
Link copied to clipboard
Determines the validity of the supplied LayoutParams object.
Link copied to clipboard
Override this method if you want to support scroll bars.
Link copied to clipboard
Override this method if you want to support scroll bars.
Link copied to clipboard
Override this method if you want to support scroll bars.
Link copied to clipboard
Override this method if you want to support scroll bars.
Link copied to clipboard
Create a default
LayoutParams
object for a child of the RecyclerView.Link copied to clipboard
Create a LayoutParams object suitable for this LayoutManager, copying relevant values from the supplied LayoutParams object if possible.
Create a LayoutParams object suitable for this LayoutManager from an inflated layout resource.
Link copied to clipboard
open fun getColumnCountForAccessibility(recycler: RecyclerView.Recycler, state: RecyclerView.State): Int
Returns the number of columns for accessibility.
Link copied to clipboard
open fun getRowCountForAccessibility(recycler: RecyclerView.Recycler, state: RecyclerView.State): Int
Returns the number of rows for accessibility.
Link copied to clipboard
Returns the number of spans laid out by this grid.
Link copied to clipboard
Returns the current SpanSizeLookup used by the GridLayoutManager.
Link copied to clipboard
Returns true if the scroll offset and scroll range calculations take account of span information.
Link copied to clipboard
open fun onFocusSearchFailed(focused: View, direction: Int, recycler: RecyclerView.Recycler, state: RecyclerView.State): View
Called when searching for a focusable view in the given direction has failed for the current content of the RecyclerView.
Link copied to clipboard
open fun onInitializeAccessibilityNodeInfo(@NonNull recycler: RecyclerView.Recycler, @NonNull state: RecyclerView.State, @NonNull info: AccessibilityNodeInfoCompat)
Called by the AccessibilityDelegate when the information about the current layout should be populated.
Link copied to clipboard
open fun onInitializeAccessibilityNodeInfoForItem(recycler: RecyclerView.Recycler, state: RecyclerView.State, host: View, info: AccessibilityNodeInfoCompat)
Called by the AccessibilityDelegate when the accessibility information for a specific item should be populated.
Link copied to clipboard
Called when items have been added to the adapter.
Link copied to clipboard
Called in response to a call to notifyDataSetChanged or swapAdapter ()} and signals that the the entire data set has changed.
Link copied to clipboard
Called when an item is moved withing the adapter.
Link copied to clipboard
Called when items have been removed from the adapter.
Link copied to clipboard
open fun onItemsUpdated(recyclerView: RecyclerView, positionStart: Int, itemCount: Int, payload: Any)
Called when items have been changed in the adapter and with optional payload.
Link copied to clipboard
Lay out all relevant child views from the given adapter.
Link copied to clipboard
Called after a full layout calculation is finished.
Link copied to clipboard
open fun scrollHorizontallyBy(dx: Int, recycler: RecyclerView.Recycler, state: RecyclerView.State): Int
Scroll horizontally by dx pixels in screen coordinates and return the distance traveled.
Link copied to clipboard
open fun scrollVerticallyBy(dy: Int, recycler: RecyclerView.Recycler, state: RecyclerView.State): Int
Scroll vertically by dy pixels in screen coordinates and return the distance traveled.
Link copied to clipboard
Sets the measured dimensions from the given bounding box of the children and the measurement specs that were passed into onMeasure.
Link copied to clipboard
Sets the number of spans to be laid out.
Link copied to clipboard
Sets the source to get the number of spans occupied by each item in the adapter.
Link copied to clipboard
stackFromEnd is not supported by GridLayoutManager.
Link copied to clipboard
When this flag is set, the scroll offset and scroll range calculations will take account of span information.
Link copied to clipboard
Returns whether this LayoutManager supports "predictive item animations".