Most visited

Recently visited

RecyclerView.LayoutParams

public static class RecyclerView.LayoutParams
extends ViewGroup.MarginLayoutParams

java.lang.Object
   ↳ android.view.ViewGroup.LayoutParams
     ↳ android.view.ViewGroup.MarginLayoutParams
       ↳ android.support.v7.widget.RecyclerView.LayoutParams
Known Direct Subclasses


LayoutParams子类RecyclerView 鼓励自定义layout managers创建其LayoutParams类的自己的子类,以存储有关该布局的任何其他所需的每个子视图元数据。

Summary

Inherited XML attributes

From class android.view.ViewGroup.MarginLayoutParams
From class android.view.ViewGroup.LayoutParams

Inherited constants

From class android.view.ViewGroup.LayoutParams

Inherited fields

From class android.view.ViewGroup.MarginLayoutParams
From class android.view.ViewGroup.LayoutParams

Public constructors

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

Public methods

int getViewAdapterPosition()

返回此LayoutParams所连接的视图所对应的最新适配器位置。

int getViewLayoutPosition()

返回此LayoutParams所连接的视图对应于最新布局计算的适配器位置。

int getViewPosition()

此方法已弃用。 使用getViewLayoutPosition()getViewAdapterPosition()

boolean isItemChanged()

如果数据集中已更改与该LayoutParams视图相对应的适配器数据项,则返回true。

boolean isItemRemoved()

如果与此LayoutParams相关的适配器数据项已从数据集中删除,则返回true。

boolean isViewInvalid()

如果此LayoutParams所连接的视图现在正在代表潜在的无效数据,则返回true。

boolean viewNeedsUpdate()

如果此LayoutParams所附的视图需要从相应的适配器更新其内容,则返回true。

Inherited methods

From class android.view.ViewGroup.MarginLayoutParams
From class android.view.ViewGroup.LayoutParams
From class java.lang.Object

Public constructors

RecyclerView.LayoutParams

RecyclerView.LayoutParams (Context c, 
                AttributeSet attrs)

Parameters
c Context
attrs AttributeSet

RecyclerView.LayoutParams

RecyclerView.LayoutParams (int width, 
                int height)

Parameters
width int
height int

RecyclerView.LayoutParams

RecyclerView.LayoutParams (ViewGroup.MarginLayoutParams source)

Parameters
source ViewGroup.MarginLayoutParams

RecyclerView.LayoutParams

RecyclerView.LayoutParams (ViewGroup.LayoutParams source)

Parameters
source ViewGroup.LayoutParams

RecyclerView.LayoutParams

RecyclerView.LayoutParams (RecyclerView.LayoutParams source)

Parameters
source RecyclerView.LayoutParams

Public methods

getViewAdapterPosition

int getViewAdapterPosition ()

返回此LayoutParams所连接的视图所对应的最新适配器位置。

Returns
int the up-to-date adapter position this view. It may return NO_POSITION if item represented by this View has been removed or its up-to-date position cannot be calculated.

getViewLayoutPosition

int getViewLayoutPosition ()

返回此LayoutParams所连接的视图对应于最新布局计算的适配器位置。

Returns
int the adapter position this view as of latest layout pass

getViewPosition

int getViewPosition ()

此方法已弃用。
使用getViewLayoutPosition()getViewAdapterPosition()

Returns
int

isItemChanged

boolean isItemChanged ()

如果数据集中已更改与该LayoutParams视图相对应的适配器数据项,则返回true。 LayoutManager可以选择以不同的方式对待它,以便为其变化的状态设置动画。

Returns
boolean true if the item the view corresponds to was changed in the data set

isItemRemoved

boolean isItemRemoved ()

如果与此LayoutParams相关的适配器数据项已从数据集中删除,则返回true。 LayoutManager可以选择以不同的方式处理它,以便为其传出或消失状态制作动画。

Returns
boolean true if the item the view corresponds to was removed from the data set

isViewInvalid

boolean isViewInvalid ()

如果此LayoutParams所连接的视图现在正在代表潜在的无效数据,则返回true。 LayoutManager应该废弃/回收它。

Returns
boolean true if the view is invalid

viewNeedsUpdate

boolean viewNeedsUpdate ()

如果此LayoutParams所附的视图需要从相应的适配器更新其内容,则返回true。

Returns
boolean true if the view should have its content updated

Hooray!