Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android RecyclerView With SectionIndexer

Anyone know how to use SectionIndexer or a substitute with RecyclerView? SectionIndexer allows ListView to popup sections when fast scrolling.

like image 764
Justin Avatar asked Nov 11 '14 21:11

Justin


1 Answers

The problem is that RecyclerView is something different than a ListView. The RecyclerView only recycles the Views and nothing more. That's the reason that there is also no FastScroll option for it how you might have discovered.

What you can do now:

  1. Implement a LayoutManager with FastScroll and the effect you want yourself
  2. Use a library. (I have found this one: https://github.com/danoz73/RecyclerViewFastScroller but haven't tested it yet)
  3. Use a ListView. I think it is not depreceated with the release of RecyclerView, because it covers use cases like yours.

Check this question for more information: How to add a fast-scroller to the RecyclerView

An interesting article about the difference of ListView and RecyclerView: https://www.bignerdranch.com/blog/recyclerview-part-1-fundamentals-for-listview-experts/

like image 187
rubengees Avatar answered Nov 05 '22 17:11

rubengees