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>(source: MarginLayoutParams!) |
|
<init>(source: LayoutParams!) |
|
<init>(source: RecyclerView.LayoutParams!) |
Public methods | |
---|---|
open Int |
Returns the up-to-date adapter position that the view this LayoutParams is attached to corresponds to in the |
open Int |
Returns the up-to-date adapter position that the view this LayoutParams is attached to corresponds to with respect to the |
open Int | |
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(source: MarginLayoutParams!)
<init>
LayoutParams(source: LayoutParams!)
<init>
LayoutParams(source: RecyclerView.LayoutParams!)
Public methods
getAbsoluteAdapterPosition
open fun getAbsoluteAdapterPosition(): Int
Returns the up-to-date adapter position that the view this LayoutParams is attached to corresponds to in the RecyclerView
. If the RecyclerView
has an Adapter
that merges other adapters, this position will be with respect to the adapter that is assigned to the RecyclerView
.
Return | |
---|---|
Int |
the up-to-date adapter position this view with respect to the RecyclerView. It may return RecyclerView#NO_POSITION if item represented by this View has been removed or its up-to-date position cannot be calculated. |
getBindingAdapterPosition
open fun getBindingAdapterPosition(): Int
Returns the up-to-date adapter position that the view this LayoutParams is attached to corresponds to with respect to the Adapter
that bound this View.
Return | |
---|---|
Int |
the up-to-date adapter position this view relative to the Adapter that bound 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. |
getViewAdapterPosition
open fungetViewAdapterPosition(): Int
Deprecated: This method is confusing when nested adapters are used. If you are calling from the context of an Adapter
, use getBindingAdapterPosition()
. If you need the position that RecyclerView
sees, use getAbsoluteAdapterPosition()
.
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 fungetViewPosition(): 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 |