项目作者: buxiliulian

项目描述 :
draw RecyclerView's indexer and sticky header with appropriate divider.
高级语言: Java
项目地址: git://github.com/buxiliulian/RecyclerViewIndexerExample.git
创建时间: 2018-05-22T03:16:06Z
项目社区:https://github.com/buxiliulian/RecyclerViewIndexerExample

开源协议:

下载


RecyclerViewIndexer

RecyclerViewIndexer Library use RecyclerView.ItemDecoration to draw a indexer, but not override RecyclerView
or custom a view to implement indexer.

alphabet_indexer

Download

maven:

  1. <dependency>
  2. <groupId>com.buxiliulian.rv</groupId>
  3. <artifactId>recyclerviewindexer</artifactId>
  4. <version>0.1.7</version>
  5. <type>pom</type>
  6. </dependency>

gradle:

  1. compile 'com.buxiliulian.rv:recyclerviewindexer:0.1.7'

Usage

  1. SimpleIndexer.Builder builder = new SimpleIndexer.Builder(this, ContactsIndexer.DEFAULT_INDEXER_CHARACTERS)
  2. .indexerTextSize(12)
  3. .padding(SimpleIndexer.DEFAULT_PADDING_DP)
  4. .indicatorColor(SimpleIndexer.DEFAULT_INDICATOR_BG_COLOR);
  5. SimpleIndexer balloonIndexer = new BalloonIndexer(builder);
  6. balloonIndexer.attachToRecyclerView(mContactsList, (rv, sectionIndex) -> {
  7. RecyclerView.Adapter adapter = rv.getAdapter();
  8. if (adapter instanceof SectionIndexer) {
  9. SectionIndexer indexer = (SectionIndexer) adapter;
  10. int pos = indexer.getPositionForSection(sectionIndex);
  11. RecyclerView.LayoutManager layoutManager = rv.getLayoutManager();
  12. if (layoutManager instanceof LinearLayoutManager) {
  13. LinearLayoutManager linearLayoutManager = (LinearLayoutManager) layoutManager;
  14. linearLayoutManager.scrollToPositionWithOffset(pos, 0);
  15. }
  16. }
  17. });
  18. }

Contact & Help

If you want to know more, please refer to https://blog.csdn.net/zwlove5280/article/details/80979207.

Please feel free to contact me if you have any question when using this library.

  1. blog: https://my.csdn.net/zwlove5280
  2. QQ Email: 509643792@qq.com
  3. Gmail: zwlove5280@gmail.com