androidlistviewandroid-listviewsectionindexer

How to Customize Alpha-Indexer While FastScrolling


I have a ListView with AlphaIndexer implementation using SectionIndexer. I was wondering that if there is anyway to customize the Aplha-Indexer box shown while fast scrolling i.e. changing its color, background, text font/color etc. Like :

enter image description here

Edited OR, When this box is adjacent to FastScroll Thumb. like:

enter image description here


Solution

  • If you are using Theme inside your application with reference to res/val/style and it's variant styles-v11 or styles-v14.Then you can surely achieve customize fastscroll indexer.

    Append these attributes in your styles-v11 or styles-v14 inside your parent Theme attribute.

    <style name="Theme.Zname" parent="@style/Theme.Sherlock.Light">
    <item name="android:fastScrollPreviewBackgroundLeft">@drawable/_ics_fastscroll_label_left</item> 
    <item name="android:fastScrollPreviewBackgroundRight">@drawable/_ics_fastscroll_label_right</item>
    </style>
    

    Here as it is using ActionBarSherlock, so styles fastScrollPreviewBackgroundLeft and fastScrollPreviewBackgroundRight are appended in it works with API >11.

    Put these inside drawable/_ics_fastscroll_label_left

    _ics_fastscroll_label_left