Google se compromete a impulsar la igualdad racial para las comunidades afrodescendientes. Obtén información al respecto.

LayoutManager

abstract class LayoutManager
kotlin.Any
   ↳ androidx.recyclerview.widget.RecyclerView.LayoutManager

A LayoutManager is responsible for measuring and positioning item views within a RecyclerView as well as determining the policy for when to recycle item views that are no longer visible to the user. By changing the LayoutManager a RecyclerView can be used to implement a standard vertically scrolling list, a uniform grid, staggered grids, horizontally scrolling collections and more. Several stock layout managers are provided for general use.

If the LayoutManager specifies a default constructor or one with the signature (Context, AttributeSet, int, int), RecyclerView will instantiate and set the LayoutManager when being inflated. Most used properties can be then obtained from getProperties(Context, AttributeSet, int, int). In case a LayoutManager specifies both constructors, the non-default constructor will take precedence.

Summary

Nested classes
abstract

Interface for LayoutManagers to request items to be prefetched, based on position, with specified distance from viewport, which indicates priority.

open

Some general properties that a LayoutManager may want to use.

Public constructors

A LayoutManager is responsible for measuring and positioning item views within a RecyclerView as well as determining the policy for when to recycle item views that are no longer visible to the user.

Public methods
open Unit

To be called only during onLayoutChildren(Recycler, State) to add a view to the layout that is known to be going away, either because it has been removed or because it is actually not in the visible portion of the container but is being laid out in order to inform RecyclerView in how to animate the item out of view.

open Unit
addDisappearingView(child: View!, index: Int)

To be called only during onLayoutChildren(Recycler, State) to add a view to the layout that is known to be going away, either because it has been removed or because it is actually not in the visible portion of the container but is being laid out in order to inform RecyclerView in how to animate the item out of view.

open Unit
addView(child: View!)

Add a view to the currently attached RecyclerView if needed.

open Unit
addView(child: View!, index: Int)

Add a view to the currently attached RecyclerView if needed.

open Unit

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

open Unit

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

open Unit
attachView(@NonNull child: View, index: Int, lp: RecyclerView.LayoutParams!)

Reattach a previously detached view.

open Unit
attachView(@NonNull child: View, index: Int)

Reattach a previously detached view.

open Unit
attachView(@NonNull child: View)

Reattach a previously detached view.

open Unit
calculateItemDecorationsForChild(@NonNull child: View, @NonNull outRect: Rect)

Calculates the item decor insets applied to the given child and updates the provided Rect instance with the inset values.

open Boolean

Query if horizontal scrolling is currently supported.

open Boolean

Query if vertical scrolling is currently supported.

open Boolean

Determines the validity of the supplied LayoutParams object.

open static Int
chooseSize(spec: Int, desired: Int, min: Int)

Chooses a size from the given specs and parameters that is closest to the desired size and also complies with the spec.

open Unit

Gather all positions from the LayoutManager to be prefetched, given specified momentum.

open Unit

Gather all positions from the LayoutManager to be prefetched in preperation for its RecyclerView to come on screen, due to the movement of another, containing RecyclerView.

open Int

Override this method if you want to support scroll bars.

open Int

Override this method if you want to support scroll bars.

open Int

Override this method if you want to support scroll bars.

open Int

Override this method if you want to support scroll bars.

open Int

Override this method if you want to support scroll bars.

open Int

Override this method if you want to support scroll bars.

open Unit

Temporarily detach and scrap all currently attached child views.

open Unit
detachAndScrapView(@NonNull child: View, @NonNull recycler: RecyclerView.Recycler)

Detach a child view and add it to a Recycler's scrap heap.

open Unit
detachAndScrapViewAt(index: Int, @NonNull recycler: RecyclerView.Recycler)

Detach a child view and add it to a Recycler's scrap heap.

open Unit
detachView(@NonNull child: View)

Temporarily detach a child view.

open Unit
detachViewAt(index: Int)

Temporarily detach a child view.

open Unit

Ends all animations on the view created by the ItemAnimator.

open View?
findContainingItemView(@NonNull view: View)

Traverses the ancestors of the given view and returns the item view that contains it and also a direct child of the LayoutManager.

open View?

Finds the view which represents the given adapter position.

abstract RecyclerView.LayoutParams!

Create a default LayoutParams object for a child of the RecyclerView.

open RecyclerView.LayoutParams!

Create a LayoutParams object suitable for this LayoutManager, copying relevant values from the supplied LayoutParams object if possible.

open RecyclerView.LayoutParams!

Create a LayoutParams object suitable for this LayoutManager from an inflated layout resource.

open Int

Returns offset of the RecyclerView's text baseline from the its top boundary.

open Int

Returns the total height of item decorations applied to child's bottom.

open View?
getChildAt(index: Int)

Return the child view at the given index

open Int

Return the current number of child views attached to the parent RecyclerView.

open static Int
getChildMeasureSpec(parentSize: Int, padding: Int, childDimension: Int, canScroll: Boolean)

Calculate a MeasureSpec value for measuring a child view in one dimension.

open static Int
getChildMeasureSpec(parentSize: Int, parentMode: Int, padding: Int, childDimension: Int, canScroll: Boolean)

Calculate a MeasureSpec value for measuring a child view in one dimension.

open Boolean

Check if the RecyclerView is configured to clip child views to its padding.

open Int

Returns the number of columns for accessibility.

open Int
getDecoratedBottom(@NonNull child: View)

Returns the bottom edge of the given child view within its parent, offset by any applied ItemDecorations.

open Unit
getDecoratedBoundsWithMargins(@NonNull view: View, @NonNull outBounds: Rect)

Returns the bounds of the view including its decoration and margins.

open Int
getDecoratedLeft(@NonNull child: View)

Returns the left edge of the given child view within its parent, offset by any applied ItemDecorations.

open Int

Returns the measured height of the given child, plus the additional size of any insets applied by ItemDecorations.

open Int

Returns the measured width of the given child, plus the additional size of any insets applied by ItemDecorations.

open Int
getDecoratedRight(@NonNull child: View)

Returns the right edge of the given child view within its parent, offset by any applied ItemDecorations.

open Int
getDecoratedTop(@NonNull child: View)

Returns the top edge of the given child view within its parent, offset by any applied ItemDecorations.

open View?

Returns the item View which has or contains focus.

open Int

Returns the height that is currently relevant to the LayoutManager.

open Int

Return the height measurement spec mode that is currently relevant to the LayoutManager.

open Int

Returns the number of items in the adapter bound to the parent RecyclerView.

open Int
getItemViewType(@NonNull view: View)

Returns the View type defined by the adapter.

open Int

Returns the resolved layout direction for this RecyclerView.

open Int
getLeftDecorationWidth(@NonNull child: View)

Returns the total width of item decorations applied to child's left.

open Int

open Int

open Int

Return the bottom padding of the parent RecyclerView

open Int

Return the end padding of the parent RecyclerView

open Int

Return the left padding of the parent RecyclerView

open Int

Return the right padding of the parent RecyclerView

open Int

Return the start padding of the parent RecyclerView

open Int

Return the top padding of the parent RecyclerView

open Int
getPosition(@NonNull view: View)

Returns the adapter position of the item represented by the given View.

open static RecyclerView.LayoutManager.Properties!
getProperties(@NonNull context: Context, @Nullable attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int)

Parse the xml attributes to get the most common properties used by layout managers.

open Int
getRightDecorationWidth(@NonNull child: View)

Returns the total width of item decorations applied to child's right.

open Int

Returns the number of rows for accessibility.

open Int