How to Customize Alpha-Indexer While FastScrolling

2019-02-26 08:44发布

问题:

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 :

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

回答1:

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