I have a list of timetable-events and would like to lay them out as in the image.
You can ignore the backgroundgrid as I will not use one.
Every event in the timetable has a start- and endtime. The height of the item in the view is related to the duration of the event. The list is observed with LiveData so changes to the timetable need to update the screen.
I considered the following approaches:
a) Using a recyclerView. Unfortunatly this either lays out the items from left to right and scrolls vertically or lays them out vertically but scrolls horizontally. I basicly need vertical layout, jumping to the next column when necessary with vertical scrolling.
b) using a gridlayout (not gridview) and spanning items over rows. Drawback is that all items need to be a multiple of a single row. This assumes all events have a duration which is a multiple of a minimum time. I can use 1 or 5 minutes as that minimum duration, but it would result in a lot of rows. Furthermore I am not sure about updating the screen, the scrolling and if this is memory efficient.
c) using a parent scroll-layout with five vertical lineairlayouts. Programmatically adding the items to the corresponding lineairlayout with the right heigth. This adds all the viewitems to the layout even if they are not visible on screen. I can forget about LiveData updates I guess.
Is there another option I have overlooked? Or can I use a recyclerView anyway? How do I do that?
P.S. I am still using Java but started to learn Kotlin