By following your example, I managed to create some expandable list, using RowHeader extends ExpandableItem and RowItem extends Item.
I am using Section to wrap every ExpandableGroup(RowHeader)
Let's say I have all references of the header in a Map, and I want to be able to scroll the recyclerView to a particular RowHeader.
My questions:
ExpandableGroup or the RowHeader reference in the map?RecyclerView to a particular RowHeader?You can hold a reference to either -- whatever you prefer!
If you hold a reference to the group, you can call:
val position = GroupAdapter.getAdapterPosition(group)
If you hold a reference to the header, you can call
val position = GroupAdapter.getAdapterPosition(item)
In either case, you can just use the position to scroll:
RecyclerView.smoothScrollToPosition(position)
@lisawray can you help me on how to get the reference of the group ,I am facing some difficulties.
You need to scroll to the position of the item 馃
Most helpful comment
You can hold a reference to either -- whatever you prefer!
If you hold a reference to the group, you can call:
If you hold a reference to the header, you can call
In either case, you can just use the position to scroll: