-2

I would like to implement RecycleView with layout that looks like the left image on this link http://www.corelangs.com/html/tables/img/colspan-rowspan.png

I only want first element to have 100% width of the row, other rows should be seperated into two columns. Any idea/tutorial how to do this?

Ales
  • 527
  • 2
  • 8
  • 24
  • Use StaggeredGridLayoutManager https://developer.android.com/reference/android/support/v7/widget/StaggeredGridLayoutManager.html – Andro Apr 27 '17 at 11:45

2 Answers2

1

use View Type for each row and make layout accordingly.

Prameshwar
  • 32
  • 6
0

I solved it this way

GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 2);
gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup()
{
    @Override
    public int getSpanSize(int position)
    {
        return (position == 0 ? 2:1);
    }
});

recyclerView.setLayoutManager(gridLayoutManager);
Ales
  • 527
  • 2
  • 8
  • 24