带字母索引的RecyclerView

问题描述:

我正在尝试建立一个RecyclerView列表,并在右侧下按字母顺序索引.我的列表显示得很完美,并且可以滚动.

I am attempting to build a RecyclerView list, with an alphabetical indexer down the right hand side. I have the list displaying perfectly and am able to scroll.

我想知道是否有人可以给我一些指导,以建立字母索引器.我相信我需要遍历列表并确定使用的字母(我可以做到).然后构建字母列表(用于索引器),然后在选择字母时使用scrollToPosition(int位置)移动到列表中的右侧项目.

I am wondering if someone could give me some guidance in building the alphabetical indexer. I believe I need to iterate through my list and determine the letters used (I can do this). Then build the list of letters (for the indexer) and then use scrollToPosition(int position) to move to the right item in the list when a letter is selected.

我无法解决的主要问题不是建立另一个列表,而是两个列表之间的通信.任何帮助将不胜感激.

The main issue that I can not work out is not building another list, it is rather the communication between the two lists. Any help would be greatly appreciated.

我相信这是您一直在寻找的信息

I believe this is the information you have been looking for as I have

您可以在此处检查这些库:

You can check these libraries here:

danoz73/RecyclerViewFastScroller

据我所记得,他是在recyclerview中实际制作了第一个字母索引器的人.我从未在我的应用程序中使它正常工作,因为自定义它存在很多问题.

as far as I remember he is the one who actually made the first alphabet indexer in recyclerview. I never made it work in my app because there was lots of problem customizing it.

AndroidDeveloperLB/LollipopContactsRecyclerViewFastScroller

自述文件说他已经做了很多优化,所以我认为这是我可以使用的最佳选择,但是我暂时还没有使其在我的应用程序中起作用.

the readme said hes got lots of optimizations made, So i think this is the best one i could use, but i havent made it work in my app for now.

code-computerlove/FastScrollRecyclerView

我认为这是您想要的设计吗?因此,您使用过的这两个库中的任何一个都可以满足您的需求.

I think this is the design you want right? So either of these libs you used it should suffice your needs.

希望对您有帮助