0

I'm breaking my head on what would be the best way to develop this element: - It has to scroll horizontally and vertically as a whole - It consists of multiple rows: uneven rows are headers, uneven rows have blocks which represent one hour - The blocks must be clickable - An event can span multiple time units en show a text or images on that span

Any thoughts on how to fix this?

Sketch

TomCB
  • 3,983
  • 9
  • 40
  • 66

1 Answers1

1

You need to use GridLayoutManger with desired number of columns. Then use

    gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
        @Override
        public int getSpanSize(int position) {
            switch(mAdapter.getItemViewType(position)){
                case MyAdapter.HEADER:
                    return <number of column>;
                case MyAdapter.ITEM:
                    return 1;
                default:
                    return -1;
            }
        }
    });

For more details see this SO post:

RecyclerView with GridLayoutManager and first element with different viewHolder

This will give you a better understanding.

Simple!!

Abu Faisal
  • 398
  • 3
  • 12