Search code examples
androidandroid-recyclerviewgridlayoutmanager

How can I make a list of lists with a RecyclerView and GridLayoutManager


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

example https://lh3.googleusercontent.com/bWNeO_FeYhGvuJ2UGNTrYVXWk4G3Re21-sOgdjM5V7ZaxehFUJDq7qaevvASs5tnbLNL=w1536-h674-rw


Solution

  • 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

    Example:

    1. Assume that you have a calendar using recycler view which holding data by ParentViewHolder.
    2. In your ParentViewHolder Create Another Recycler View Like ChildRecyclerView.
    3. Create ChildAdapter for ChildRecyclerView that holding vertical item using ChildViewHolder.
    4. Add your necessary action on ChildViewHolder.