3

How can we add an alphabetic indicator to our CardScrollView like the google glass contact list has.

enter image description here

I currently have my list sorted with a compare statement and they are put in correctly. now when you hard swipe(so it scrolls faster through the cards and the indicator actually shows up) or when you hold the touchpad with 2 fingers the indicator should show up.

Does anyone have any idea how to make sure the indicator shows up and how to check which letter should be shown?

note: should there be used some special layout to achive this?

Community
  • 1
  • 1
NoSixties
  • 2,443
  • 2
  • 28
  • 65

3 Answers3

0

You can implement SectionIndexer in the same as as it is done in any android application while performing a hard scroll.

Please have a look at the following tutorial.

AniV
  • 3,997
  • 1
  • 12
  • 17
  • I tried using this tutorial however it doesn't show up for me when swiping. Please do note that for the `CardScrollView` the following adapter is being used `CardScrollAdapter` could it be that this is causing it to not show up for me? Is there a way to make sure it does show up – NoSixties Mar 31 '15 at 13:33
0

I dont think that CardScrollView has support for SectionIndexer / fastScroll, only AbsListView (ListView, GridView etc) has that.

You could try implementing it on your own if you like, it shouldnt be too hard to do a simple varation without fastScroll, I would do something like checking on the adapter's getView() method for what view is currently showing and update an overalaping TextView with the first letter accordingly. You could also put a timer and a Touch Listener to only enable this when fast scrolling (getView's timer is updated faster that x milliseconds) or when touching with two fingers.

Also check the setHorizontalScrollBarEnabled() of the CardScrollView to see if thats something you need.

Evripidis Drakos
  • 872
  • 1
  • 7
  • 15
0

use ascii value .. increase it accordingly and than convert to text when and show visibility accordingly .. Hope you understood

vaibhav
  • 634
  • 1
  • 4
  • 23