public class ItemSpaceDecoration extends RecyclerViewItemDecoration
RecyclerViewItemDecoration implementation that may be used to add a space,
vertically and horizontally, between items displayed in a RecyclerView.
ItemSpaceDecoration Attributes
noneRecyclerView#addItemDecoration(RecyclerView.ItemDecoration)| Constructor and Description |
|---|
ItemSpaceDecoration()
Same as
ItemSpaceDecoration(Context) with null context. |
ItemSpaceDecoration(android.content.Context context)
Same as
ItemSpaceDecoration(Context, AttributeSet) with null attrs. |
ItemSpaceDecoration(android.content.Context context,
android.util.AttributeSet attrs)
Same as
ItemSpaceDecoration(Context, AttributeSet, int) with 0 defStyleAttr. |
ItemSpaceDecoration(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr)
Same as
ItemSpaceDecoration(Context, AttributeSet, int, int) with 0 defStyleRes. |
ItemSpaceDecoration(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr,
int defStyleRes)
Creates a new instance of ItemSpaceDecoration for the given context.
|
ItemSpaceDecoration(int horizontal,
int vertical)
Same as
ItemSpaceDecoration(int, int, int, int) where the specified horizontal
amount will be used for both, horizontal start and horizontal end amounts, and the vertical
amount will be used similarly for both, vertical start and vertical end amounts. |
ItemSpaceDecoration(int horizontalStart,
int horizontalEnd,
int verticalStart,
int verticalEnd)
Creates a new instance of ItemSpaceDecoration with the specified spacing amounts.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getHorizontalEnd()
Returns the amount of space that will be applied at the end of each item in horizontal direction.
|
int |
getHorizontalStart()
Returns the amount of space that will be applied at the start of each item in horizontal direction.
|
void |
getItemOffsets(android.graphics.Rect rect,
android.view.View view,
RecyclerView parent,
RecyclerView.State state) |
int |
getVerticalEnd()
Returns the amount of space that will be applied at the end of each item in vertical direction.
|
int |
getVerticalStart()
Returns the amount of space that will be applied at the start of each item in vertical direction.
|
setSkipFirst, setSkipLast, shouldDecorate, skipsFirst, skipsLastpublic ItemSpaceDecoration()
ItemSpaceDecoration(Context) with null context.public ItemSpaceDecoration(int horizontal,
int vertical)
ItemSpaceDecoration(int, int, int, int) where the specified horizontal
amount will be used for both, horizontal start and horizontal end amounts, and the vertical
amount will be used similarly for both, vertical start and vertical end amounts.public ItemSpaceDecoration(int horizontalStart,
int horizontalEnd,
int verticalStart,
int verticalEnd)
horizontalStart - Amount to be applied at the start of an item in horizontal direction.horizontalEnd - Amount to be applied at the end of an item in horizontal direction.verticalStart - Amount to be applied at the start of an item in vertical direction.verticalEnd - Amount to be applied at the end of an item in vertical direction.public ItemSpaceDecoration(android.content.Context context)
ItemSpaceDecoration(Context, AttributeSet) with null attrs.public ItemSpaceDecoration(android.content.Context context,
android.util.AttributeSet attrs)
ItemSpaceDecoration(Context, AttributeSet, int) with 0 defStyleAttr.public ItemSpaceDecoration(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr)
ItemSpaceDecoration(Context, AttributeSet, int, int) with 0 defStyleRes.public ItemSpaceDecoration(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr,
int defStyleRes)
context - Context in which will be the new decoration presented.attrs - Set of Xml attributes used to configure the new instance of this decoration.defStyleAttr - An attribute which contains a reference to a default style resource for
this decoration within a theme of the given context.defStyleRes - Resource id of the default style for the new decoration.ItemSpaceDecoration(int, int, int, int)public int getHorizontalStart()
getHorizontalEnd()public int getHorizontalEnd()
getHorizontalStart()public int getVerticalStart()
getVerticalEnd()public int getVerticalEnd()
getVerticalStart()public void getItemOffsets(android.graphics.Rect rect,
android.view.View view,
RecyclerView parent,
RecyclerView.State state)