RecyclerView.LayoutParams

public static class RecyclerView.LayoutParams
extends ViewGroup.MarginLayoutParams

java.lang.Object
   ↳ android.view.ViewGroup.LayoutParams
     ↳ android.view.ViewGroup.MarginLayoutParams
       ↳ androidx.recyclerview.widget.RecyclerView.LayoutParams


LayoutParams subclass for children of RecyclerView. Custom layout managers are encouraged to create their own subclass of this LayoutParams class to store any additional required per-child view metadata about the layout.

Summary

Inherited constants

Inherited fields

Public constructors

LayoutParams(Context c, AttributeSet attrs)
LayoutParams(int width, int height)
LayoutParams(ViewGroup.MarginLayoutParams source)
LayoutParams(ViewGroup.LayoutParams source)
LayoutParams(RecyclerView.LayoutParams source)

Public methods

int getAbsoluteAdapterPosition()

Returns the up-to-date adapter position that the view this LayoutParams is attached to corresponds to in the RecyclerView.

int getBindingAdapterPosition()

Returns the up-to-date adapter position that the view this LayoutParams is attached to corresponds to with respect to the RecyclerView.Adapter that bound this View.

int getViewAdapterPosition()

This method is deprecated. This method is confusing when nested adapters are used. If you are calling from the context of an RecyclerView.Adapter, use getBindingAdapterPosition(). If you need the position that RecyclerView sees, use getAbsoluteAdapterPosition().

int getViewLayoutPosition()

Returns the adapter position that the view this LayoutParams is attached to corresponds to as of latest layout calculation.

int getViewPosition()

This method is deprecated. use getViewLayoutPosition() or getViewAdapterPosition()

boolean isItemChanged()

Returns true if the adapter data item corresponding to the view this LayoutParams is attached to has been changed in the data set.

boolean isItemRemoved()

Returns true if the adapter data item corresponding to the view this LayoutParams is attached to has been removed from the data set.

boolean isViewInvalid()

Returns true if the view this LayoutParams is attached to is now representing potentially invalid data.

boolean viewNeedsUpdate()

Returns true if the view this LayoutParams is attached to needs to have its content updated from the corresponding adapter.

Inherited methods