I am extending RecyclerView.ItemDecoration
to define a class that enables a RecyclerView
to make header view's sticky when they are at the top of the RecyclerView
. For this, I need to override onDrawOver()
to draw the sticky header , since I need to draw the sticky header on top of all the other RecyclerView
view's. This has the unfortunate side effect of also drawing the sticky header on top of the RecyclerView
's scrollbar. I am wondering if there is some way I can easily get the RecyclerView
to draw it's scrollbar over this sticky header?
I've tried doing the following already:
- Mess around with
android:scrollbarStyle
XML tag onRecyclerView
. Setting this tooutsideOverlay
does not draw the scrollbar over the sticky header. - Move sticky header drawing logic to
onDraw()
instead ofonDrawOver()
. Doing this draws the sticky header underneath the scrollbar, but also draws it underneath theRecyclerView
's other views.
Any feedback is helpful. Thanks.