public class ItemDivider
extends RecyclerView.ItemDecoration
RecyclerView.ItemDecoration that can be used as a divider
between items of a android.support.v7.widget.LinearLayoutManager. It supports both HORIZONTAL and
VERTICAL orientations.
mDividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(),
mLayoutManager.getOrientation());
recyclerView.addItemDecoration(mDividerItemDecoration);
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
HORIZONTAL |
static int |
VERTICAL |
| 构造器和说明 |
|---|
ItemDivider(android.content.Context context,
int orientation)
Creates a divider
RecyclerView.ItemDecoration that can be used with a
android.support.v7.widget.LinearLayoutManager. |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
getItemOffsets(android.graphics.Rect outRect,
android.view.View view,
RecyclerView parent,
RecyclerView.State state) |
void |
onDraw(android.graphics.Canvas c,
RecyclerView parent,
RecyclerView.State state) |
void |
setDrawable(android.graphics.drawable.Drawable drawable)
Sets the
Drawable for this divider. |
void |
setLastItemNoDivider(boolean mLastItemNoDivider) |
void |
setOrientation(int orientation)
Sets the orientation for this divider.
|
void |
setPadding(android.graphics.Rect padding) |
void |
setSize(int size) |
public static final int HORIZONTAL
public static final int VERTICAL
public ItemDivider(android.content.Context context,
int orientation)
RecyclerView.ItemDecoration that can be used with a
android.support.v7.widget.LinearLayoutManager.context - Current context, it will be used to access resources.orientation - Divider orientation. Should be HORIZONTAL or VERTICAL.public void setOrientation(int orientation)
RecyclerView.LayoutManager changes orientation.orientation - HORIZONTAL or VERTICALpublic void setDrawable(android.graphics.drawable.Drawable drawable)
Drawable for this divider.drawable - Drawable that should be used as a divider.public void onDraw(android.graphics.Canvas c,
RecyclerView parent,
RecyclerView.State state)
public void getItemOffsets(android.graphics.Rect outRect,
android.view.View view,
RecyclerView parent,
RecyclerView.State state)
public void setSize(int size)
public void setPadding(android.graphics.Rect padding)
public void setLastItemNoDivider(boolean mLastItemNoDivider)