简体   繁体   中英

Showing Alphabetic Indicator in CardScrollView

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

在此输入图像描述

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?

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 .

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.

使用ascii值..相应地增加它,然后转换为文本,并相应地显示可见性。希望你理解

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM