LayoutParams

open class LayoutParams : MarginLayoutParams
kotlin.Any
   ↳ 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

Public constructors

<init>(c: Context!, attrs: AttributeSet!)

<init>(width: Int, height: Int)

<init>(source: LayoutParams!)

Public methods

open Int

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

open Int

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

open Int

open Boolean

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

open Boolean

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

open Boolean

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

open Boolean

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

Public constructors

<init>

LayoutParams(c: Context!, attrs: AttributeSet!)

<init>

LayoutParams(width: Int, height: Int)

<init>

LayoutParams(source: MarginLayoutParams!)

<init>

LayoutParams(source: LayoutParams!)

<init>

LayoutParams(source: RecyclerView.LayoutParams!)

Public methods

getViewAdapterPosition

open fun getViewAdapterPosition(): Int

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

Return
Int: the up-to-date adapter position this view. It may return RecyclerView#NO_POSITION if item represented by this View has been removed or its up-to-date position cannot be calculated.

getViewLayoutPosition

open fun getViewLayoutPosition(): Int

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

Return
Int: the adapter position this view as of latest layout pass

getViewPosition

open fun getViewPosition(): Int

Deprecated: use getViewLayoutPosition() or getViewAdapterPosition()

isItemChanged

open fun isItemChanged(): Boolean

Returns true if the adapter data item corresponding to the view this LayoutParams is attached to has been changed in the data set. A LayoutManager may choose to treat it differently in order to animate its changing state.

Return
Boolean: true if the item the view corresponds to was changed in the data set

isItemRemoved

open fun isItemRemoved(): Boolean

Returns true if the adapter data item corresponding to the view this LayoutParams is attached to has been removed from the data set. A LayoutManager may choose to treat it differently in order to animate its outgoing or disappearing state.

Return
Boolean: true if the item the view corresponds to was removed from the data set

isViewInvalid

open fun isViewInvalid(): Boolean

Returns true if the view this LayoutParams is attached to is now representing potentially invalid data. A LayoutManager should scrap/recycle it.

Return
Boolean: true if the view is invalid

viewNeedsUpdate

open fun viewNeedsUpdate(): Boolean

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

Return
Boolean: true if the view should have its content updated