Hello. It is necessary to make headings in RecyclerView according to this scheme.
А Анна Алексей ... Б Борька ... В Ваня The list is already in sorted form is transferred to the adapter, but I can not figure out how to register this logic. Approximately I understand this:
1) Create two constants for two types ( HEADER_ITEM , NORMAL_ITEM ).
2) In the getItemViewType method getItemViewType by some algorithm, calculate when the words per letter end and in this case return HEADER_ITEM .
3) In onCreateViewHolder , depending on the type of item, create different holders.
And then it is not clear. It turns out you need 2 holders? And how to bind the data? And another question - what will happen to the position? Hopefully, in RecyclerView , they thought that the header should not contain a position. Or two holders are created for this? Please explain, I recently switched to the ListView recycler and a lot of things seem complicated.
RecyclerView. In general, there are a lot of such adapters on GitHub . - pavlofff