I have a list of days and every day has a list of events. How do I show the list of events within the day item? same as google calendar
In you day cell, create another recycler view that hold ( vertical item ). Assume that each position have different list of data so collect data from each parent position and set to childAdapter of each position
- Assume that you have a calendar using recycler view which holding data by ParentViewHolder.
- In your ParentViewHolder Create Another Recycler View Like ChildRecyclerView.
- Create ChildAdapter for ChildRecyclerView that holding vertical item using ChildViewHolder.
- Add your necessary action on ChildViewHolder.
1.The day item view in a RecyclerView with a GridLayoutManger
2.The event item view in a RecyclerView with a LinearLayoutManger
3.Set the event RecyclerView’s height to wrap_content
4.To make good performance you should make all RecyclerView use a same RecyclerViewPool:
// field var globalViewPool = RecycledViewPool() // .... // init view dayRecyclerView.setRecycledViewPool(globalViewPool)
// onCreateViewHolder eventRecyclerView.setRecycledViewPool(globalViewPool)