I had the same problem, and after several hours of research, I came up with a solution. This AOSP commit helped me the most, it shows the changes made to the scrollbar in Android 5.1 (SDK 22): Update scrollbars according to material specification
There are two possibilities:

A: use a new style and add an addition
This will keep the same new rectangle from API 21 (Android 5.1), but add some additions left and right.
1: Copy the fastscroll_thumb_material.xml file to the folder with your hair
This should be the content (deleted AOSP comments to save space):
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true"> <shape android:tint="?attr/colorControlActivated" android:shape="rectangle"> <solid android:color="@android:color/white" /> <size android:width="8dp" android:height="48dp" /> </shape> </item> <item> <shape android:tint="?attr/colorControlNormal" android:shape="rectangle"> <solid android:color="@android:color/white" /> <size android:width="8dp" android:height="48dp" /> </shape> </item> </selector>
2: edit the theme
Add the following element to your topic. I think you can put this in style and use it with setFastScrollStyle , but I find it easier.
<item name="android:fastScrollThumbDrawable">@drawable/fastscroll_thumb_material</item>
3: Edit fastscroll_thumb_material.xml
You can edit it to your liking, but I did the following, which adds 8dp to the left and right of the scroll bar. I added a list of layers and an element around each shape and added android:right="8dp" and android:left="8dp" to the new element. I tried to add this to the original elements, but it didnβt work, and there were no additions to the form.
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true"> <layer-list> <item android:right="8dp" android:left="8dp"> <shape android:tint="?attr/colorControlActivated" android:shape="rectangle"> <solid android:color="@android:color/white" /> <size android:width="8dp" android:height="48dp" /> </shape> </item> </layer-list> </item> <item> <layer-list> <item android:right="8dp" android:left="8dp"> <shape android:tint="?attr/colorControlNormal" android:shape="rectangle"> <solid android:color="@android:color/white" /> <size android:width="8dp" android:height="48dp" /> </shape> </item> </layer-list> </item> </selector>
B: change the scrollbar to old style
This will use the API 21 style, Android 5.0
1: add old drawings to the project
You can download them from the above (fastscroll_thumb_mtrl_alpha.png and fastscroll_track_mtrl_alpha.9.png), but I also linked them, you can also download them from my Google Drive .
2: add fastscroll_thumb_material.xml to your drawings
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true"> <bitmap android:src="@drawable/fastscroll_thumb_mtrl_alpha" android:tint="?attr/colorControlActivated" /> </item> <item> <bitmap android:src="@drawable/fastscroll_thumb_mtrl_alpha" android:tint="?attr/colorControlNormal" /> </item> </selector>
3: add fastscroll_track_material.xml to your drawings
<?xml version="1.0" encoding="utf-8"?> <nine-patch xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/fastscroll_track_mtrl_alpha" android:tint="?attr/colorControlNormal" />
4: edit your theme
Add the following element to your topic. I think you can put this in style and use it with setFastScrollStyle , but I find it easier.
<item name="android:fastScrollThumbDrawable">@drawable/fastscroll_thumb_material</item> <item name="android:fastScrollTrackDrawable">@drawable/fastscroll_track_material</item>
Hope this helps to achieve your goal :)