Android RecyclerView Decorations

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Syntax

Parameters

ParameterDetails
decorationthe item decoration to add to the RecyclerView
indexthe index in the list of decorations for this RecyclerView. This is the order in which getItemOffset and onDraw are called. Later calls might overdraw previous ones.

Remarks

Decorations are static

Since decorations are only drawn, it is not possible to add click listeners or other UI functionality to them.

Multiple decorations

Adding multiple decorations to a RecyclerView will work in some cases, but there is currently no public API to take other possible decorations into account when measuring or drawing. You can get the view bounds or the view decorated bounds, where the decorated bounds are the sum of all the decoration offsets applied.

Other related topics:

RecyclerView
RecyclerView onClickListeners

Official javadoc

https://developer.android.com/reference/android/support/v7/widget/RecyclerView.ItemDecoration.html



Got any Android Question?