2

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

BST Kaal
  • 2,993
  • 6
  • 34
  • 52

1 Answers1

4

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

Vikalp Patel
  • 10,669
  • 6
  • 61
  • 96
  • Why it can't be done in `style` rather than `style-v11`. – BST Kaal Jun 12 '14 at 06:06
  • I included these lines in my `style-11` file as : `` But its just changing the color of rectangular box and the triangular shape is not showing. – BST Kaal Jun 12 '14 at 06:12
  • 1
    @BSTKaal : As you are using `android:color` it will definitely shows rectangular box only. Try to use your `custom drawable` with triangular shape in it. As i have already stated in answer. – Vikalp Patel Jun 12 '14 at 06:14
  • 1
    @BSTKaal : You can add `fastScrollPreviewBackgroundLeft` or `fastScrollPreviewBackgroundRight` inside your `styles` incase if you are using Theme.Holo. For more information went through these https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/res/res/values/themes.xml and why i stated to use it in `styles-v11` as it's added in API 11 http://developer.android.com/reference/android/R.attr.html#fastScrollPreviewBackgroundLeft – Vikalp Patel Jun 12 '14 at 06:16
  • Hello @Vikalp Patel, can u plz take a look at http://stackoverflow.com/questions/24863038/avoid-swiperefresh-while-fastscrolling-in-android plz, i m stuck in the middle of app – BST Kaal Jul 23 '14 at 09:16