public static class GridLayoutManager.LayoutParams
extends RecyclerView.LayoutParams
java.lang.Object | ||||
↳ | android.view.ViewGroup.LayoutParams | |||
↳ | android.view.ViewGroup.MarginLayoutParams | |||
↳ | android.support.v7.widget.RecyclerView.LayoutParams | |||
↳ | android.support.v7.widget.GridLayoutManager.LayoutParams |
GridLayoutManager使用的LayoutParams。
请注意,如果方向为 VERTICAL
,则宽度参数将被忽略,如果方向为 HORIZONTAL
则高度参数将被忽略,因为子视图预计会填充为其指定的所有空间。
Inherited XML attributes |
|
---|---|
From class android.view.ViewGroup.MarginLayoutParams
|
|
From class android.view.ViewGroup.LayoutParams
|
Constants |
|
---|---|
int |
INVALID_SPAN_ID 尚未布置视图的跨度ID。 |
Inherited constants |
---|
From class android.view.ViewGroup.LayoutParams
|
Inherited fields |
---|
From class android.view.ViewGroup.MarginLayoutParams
|
From class android.view.ViewGroup.LayoutParams
|
Public constructors |
|
---|---|
GridLayoutManager.LayoutParams(Context c, AttributeSet attrs) |
|
GridLayoutManager.LayoutParams(int width, int height) |
|
GridLayoutManager.LayoutParams(ViewGroup.MarginLayoutParams source) |
|
GridLayoutManager.LayoutParams(ViewGroup.LayoutParams source) |
|
GridLayoutManager.LayoutParams(RecyclerView.LayoutParams source) |
Public methods |
|
---|---|
int |
getSpanIndex() 返回此视图的当前跨度索引。 |
int |
getSpanSize() 返回此视图占用的跨度数。 |
Inherited methods |
|
---|---|
From class android.support.v7.widget.RecyclerView.LayoutParams
|
|
From class android.view.ViewGroup.MarginLayoutParams
|
|
From class android.view.ViewGroup.LayoutParams
|
|
From class java.lang.Object
|
int INVALID_SPAN_ID
尚未布置视图的跨度ID。
常量值:-1(0xffffffff)
GridLayoutManager.LayoutParams (Context c, AttributeSet attrs)
Parameters | |
---|---|
c |
Context
|
attrs |
AttributeSet
|
GridLayoutManager.LayoutParams (int width, int height)
Parameters | |
---|---|
width |
int
|
height |
int
|
GridLayoutManager.LayoutParams (ViewGroup.MarginLayoutParams source)
Parameters | |
---|---|
source |
ViewGroup.MarginLayoutParams
|
GridLayoutManager.LayoutParams (ViewGroup.LayoutParams source)
Parameters | |
---|---|
source |
ViewGroup.LayoutParams
|
GridLayoutManager.LayoutParams (RecyclerView.LayoutParams source)
Parameters | |
---|---|
source |
RecyclerView.LayoutParams
|
int getSpanIndex ()
返回此视图的当前跨度索引。 如果视图尚未布置,则返回值为undefined
。
请注意,span索引可能会因RecyclerView是否为RTL而改变。 例如,如果跨度数为3,布局为RTL,则最右边的项目将具有跨度索引2.如果布局更改回LTR,则此视图的跨度索引将为0.如果项目占用2个跨度,跨度指数分别为1和0。
如果视图占用多个跨度,则返回具有最小索引的跨度。
Returns | |
---|---|
int |
The span index of the View. |
int getSpanSize ()
返回此视图占用的跨度数。 如果视图尚未布置,则返回值为undefined
。
Returns | |
---|---|
int |
The number of spans occupied by this View. |