belongs to Maven artifact com.android.support:recyclerview-v7:28.0.0-alpha1
RecyclerView.ItemDecoration
public
static
abstract
class
RecyclerView.ItemDecoration
extends Object
java.lang.Object | |
↳ | android.support.v7.widget.RecyclerView.ItemDecoration |
Known Direct Subclasses |
An ItemDecoration allows the application to add a special drawing and layout offset to specific item views from the adapter's data set. This can be useful for drawing dividers between items, highlights, visual grouping boundaries and more.
All ItemDecorations are drawn in the order they were added, before the item
views (in onDraw()
and after the items (in onDrawOver(Canvas, RecyclerView, RecyclerView.State)
.
Summary
Public constructors | |
---|---|
RecyclerView.ItemDecoration()
|
Public methods | |
---|---|
void
|
getItemOffsets(Rect outRect, int itemPosition, RecyclerView parent)
This method was deprecated
in API level 22.1.0.
Use |
void
|
getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state)
Retrieve any offsets for the given item. |
void
|
onDraw(Canvas c, RecyclerView parent)
This method was deprecated
in API level 22.1.0.
Override |
void
|
onDraw(Canvas c, RecyclerView parent, RecyclerView.State state)
Draw any appropriate decorations into the Canvas supplied to the RecyclerView. |
void
|
onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state)
Draw any appropriate decorations into the Canvas supplied to the RecyclerView. |
void
|
onDrawOver(Canvas c, RecyclerView parent)
This method was deprecated
in API level 22.1.0.
Override |
Inherited methods | |
---|---|
From
class
java.lang.Object
|
Public constructors
Public methods
getItemOffsets
void getItemOffsets (Rect outRect, int itemPosition, RecyclerView parent)
This method was deprecated
in API level 22.1.0.
Use getItemOffsets(Rect, View, RecyclerView, State)
Parameters | |
---|---|
outRect |
Rect |
itemPosition |
int |
parent |
RecyclerView |
getItemOffsets
void getItemOffsets (Rect outRect, View view, RecyclerView parent, RecyclerView.State state)
Retrieve any offsets for the given item. Each field of outRect
specifies
the number of pixels that the item view should be inset by, similar to padding or margin.
The default implementation sets the bounds of outRect to 0 and returns.
If this ItemDecoration does not affect the positioning of item views, it should set
all four fields of outRect
(left, top, right, bottom) to zero
before returning.
If you need to access Adapter for additional data, you can call
getChildAdapterPosition(View)
to get the adapter position of the
View.
Parameters | |
---|---|
outRect |
Rect : Rect to receive the output. |
view |
View : The child view to decorate |
parent |
RecyclerView : RecyclerView this ItemDecoration is decorating |
state |
RecyclerView.State : The current state of RecyclerView.
|
onDraw
void onDraw (Canvas c, RecyclerView parent)
This method was deprecated
in API level 22.1.0.
Override onDraw(Canvas, RecyclerView, RecyclerView.State)
Parameters | |
---|---|
c |
Canvas |
parent |
RecyclerView |
onDraw
void onDraw (Canvas c, RecyclerView parent, RecyclerView.State state)
Draw any appropriate decorations into the Canvas supplied to the RecyclerView. Any content drawn by this method will be drawn before the item views are drawn, and will thus appear underneath the views.
Parameters | |
---|---|
c |
Canvas : Canvas to draw into |
parent |
RecyclerView : RecyclerView this ItemDecoration is drawing into |
state |
RecyclerView.State : The current state of RecyclerView
|
onDrawOver
void onDrawOver (Canvas c, RecyclerView parent, RecyclerView.State state)
Draw any appropriate decorations into the Canvas supplied to the RecyclerView. Any content drawn by this method will be drawn after the item views are drawn and will thus appear over the views.
Parameters | |
---|---|
c |
Canvas : Canvas to draw into |
parent |
RecyclerView : RecyclerView this ItemDecoration is drawing into |
state |
RecyclerView.State : The current state of RecyclerView.
|
onDrawOver
void onDrawOver (Canvas c, RecyclerView parent)
This method was deprecated
in API level 22.1.0.
Override onDrawOver(Canvas, RecyclerView, RecyclerView.State)
Parameters | |
---|---|
c |
Canvas |
parent |
RecyclerView |
Annotations
Interfaces
- ActionMenuView.OnMenuItemClickListener
- PopupMenu.OnDismissListener
- PopupMenu.OnMenuItemClickListener
- RecyclerView.ChildDrawingOrderCallback
- RecyclerView.ItemAnimator.ItemAnimatorFinishedListener
- RecyclerView.LayoutManager.LayoutPrefetchRegistry
- RecyclerView.OnChildAttachStateChangeListener
- RecyclerView.OnItemTouchListener
- RecyclerView.RecyclerListener
- RecyclerView.SmoothScroller.ScrollVectorProvider
- SearchView.OnCloseListener
- SearchView.OnQueryTextListener
- SearchView.OnSuggestionListener
- ShareActionProvider.OnShareTargetSelectedListener
- ThemedSpinnerAdapter
- Toolbar.OnMenuItemClickListener
Classes
- ActionMenuView
- ActionMenuView.LayoutParams
- AppCompatAutoCompleteTextView
- AppCompatButton
- AppCompatCheckBox
- AppCompatCheckedTextView
- AppCompatEditText
- AppCompatImageButton
- AppCompatImageView
- AppCompatMultiAutoCompleteTextView
- AppCompatRadioButton
- AppCompatRatingBar
- AppCompatSeekBar
- AppCompatSpinner
- AppCompatTextView
- CardView
- DefaultItemAnimator
- DividerItemDecoration
- GridLayout
- GridLayout.Alignment
- GridLayout.LayoutParams
- GridLayout.Spec
- GridLayoutManager
- GridLayoutManager.DefaultSpanSizeLookup
- GridLayoutManager.LayoutParams
- GridLayoutManager.SpanSizeLookup
- LinearLayoutCompat
- LinearLayoutCompat.LayoutParams
- LinearLayoutManager
- LinearLayoutManager.LayoutChunkResult
- LinearSmoothScroller
- LinearSnapHelper
- ListPopupWindow
- OrientationHelper
- PagerSnapHelper
- PopupMenu
- RecyclerView
- RecyclerView.Adapter
- RecyclerView.AdapterDataObserver
- RecyclerView.EdgeEffectFactory
- RecyclerView.ItemAnimator
- RecyclerView.ItemAnimator.ItemHolderInfo
- RecyclerView.ItemDecoration
- RecyclerView.LayoutManager
- RecyclerView.LayoutManager.Properties
- RecyclerView.LayoutParams
- RecyclerView.OnFlingListener
- RecyclerView.OnScrollListener
- RecyclerView.RecycledViewPool
- RecyclerView.Recycler
- RecyclerView.SimpleOnItemTouchListener
- RecyclerView.SmoothScroller
- RecyclerView.SmoothScroller.Action
- RecyclerView.State
- RecyclerView.ViewCacheExtension
- RecyclerView.ViewHolder
- RecyclerViewAccessibilityDelegate
- RecyclerViewAccessibilityDelegate.ItemDelegate
- SearchView
- ShareActionProvider
- SimpleItemAnimator
- SnapHelper
- StaggeredGridLayoutManager
- StaggeredGridLayoutManager.LayoutParams
- SwitchCompat
- ThemedSpinnerAdapter.Helper
- Toolbar
- Toolbar.LayoutParams
- Toolbar.SavedState
- TooltipCompat