0

What I want to reach at the end, a view like this image, Click me

  • I have RecyclerView and I am using GridLayoutManager.
  • I want to have 5 items of the list in the first row.
  • The rest of the rows should contain 6 items per each row.
  • Items in the first row has a bigger sizes than the others.

I tried gridLayoutManager.setSpanSizeLookup(...)

Please advise. Thanks in advance.

  • here: https://stackoverflow.com/questions/33579800/best-way-to-implement-header-over-a-recyclerview-using-a-grid-layout – Hoàng Vũ Anh Oct 06 '20 at 08:20
  • Unfortunately I tried this: `@Override public int getSpanSize(int position) { return (position == 0) ? 3 : 1; }` but it is just making the first item takes space of 3 items. – Ahmed Etman Oct 06 '20 at 09:20

1 Answers1

0

There is a library Called Groupi which makes working with RecyclerView very easy. See this for example.

ObinasBaba
  • 478
  • 2
  • 8
  • unfortunately it is not the same behavior. – Ahmed Etman Oct 06 '20 at 09:57
  • @Ahmed, The GIF in the link is not the only "behavior" you can do with the Library, You can customize any item you want to include in Recyclerview. Read the doc [link] (https://github.com/lisawray/groupie), I left out the code how to do it because its a little verbose – ObinasBaba Oct 06 '20 at 10:11