How to display the custom thumb when using fastScrollEnabled


I have a listview of countries in non-alphabetic order and started using fastscroll. I would like to display the country-flag when scrolling with fastscroll but it seems like the APIs has the FastScroll class as private so I cannot override it.

Have anyone else implemented a custom fastscroll view?


In your ListView XML definition, add


or in code


Create file fastscroll_thumb.xml in the res/drawable folder as follows:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="">
    <item android:state_pressed="true" android:drawable="@drawable/fastscroll_pressed" />
    <item android:drawable="@drawable/fastscroll" />

In AndroidManifest.xml, set a custom theme for your application:


Create a values folder in the res folder. Create themes.xml files in res/values as follows:

    <style name="ApplicationTheme">
        <item name="android:fastScrollThumbDrawable">@drawable/fastscroll_thumb</item>

Lastly make sure that fastscroll.png and fastscroll_pressed.png exist in your drawable folder

(optional) You can also set fast scroll always visible while you are debugging if you like


or in XML