Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RecyclerView no scrollbar when overscroll is turned off

I am trying to avoid the overscroll shadow on the RecyclerView. However, it seems that adding android:overScrollMode="never" has the side effect of hiding any vertical and horizontal scrollbars that were present in the RecyclerView. Does anyone know how to have scrollbars showing while avoiding the overscroll shadows?

like image 549
Jin Avatar asked Sep 14 '15 23:09

Jin


2 Answers

Just to make the answer complete:

RecyclerView doesn't draw scrollbars due to willnotdraw flag. This flag is set to true, when neither the background nor the edge effects (overScrollMode="never") are there. It's a drawing code optimisation for layouts. It should also be affected by the state of either of the scrollbars.

To fix it properly without setting the background you have to call setWillNotDraw(false)

like image 196
Zielony Avatar answered Nov 17 '22 10:11

Zielony


I'm not sure that my answer will be correct, but i had the same problem with visability of scrollbars in RecyclerView. And it wasn't caused by android:overScrollMode property.
In my case the reason was that scollbars of RecyclerView doesn't work properly on some old devices if the android:background property is not set. Try to set it to any color or to transparent

like image 22
smbd uknow Avatar answered Nov 17 '22 11:11

smbd uknow