4

I have a collection of photos, and I'm using a RecyclerView to display them. I want to have the first element in my RecyclerView span 2 columns AND 2 rows: enter image description here

How can i achive that , i know that using GridLayoutManager you can do this

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

but this only take columns not rows , So How can i achieve this layout in RecyclerView ? ,, Note : this layout is used in instagram and Google Photos.

this question has been asked befor but with no solution "Good solution"

Saef Myth
  • 287
  • 8
  • 19

0 Answers0