added in version 22.1.0
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 getItemOffsets(Rect, View, RecyclerView, State)

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 onDraw(Canvas, RecyclerView, RecyclerView.State)

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 onDrawOver(Canvas, RecyclerView, RecyclerView.State)

Inherited methods

From class java.lang.Object