Eddie Williams
Eddie Williams

Reputation: 83

How can accomplish this design using Recycler Views in Android?

enter image description here

How can I accomplish the above design using recycler view list adapter, prefarably in kotlin (Java is fine too).

I was wondering if there was a way to accomplish this without third party libraries, just using StaggeredGridLayoutManager

Upvotes: 0

Views: 57

Answers (1)

Some random IT boy
Some random IT boy

Reputation: 8457

Yes you can. This is just a RecyclerView with StaggeredGridLayoutManager and two different RecyclerView.ViewHolder implementations.

  1. Create a layout file that only contains one squared ImageView and create a RecyclerView.ViewHolder
  2. Create a layout file that contains a wrapper that is the same size as the previous and contains 4 ImageView and create a RecyclerView.ViewHolder for that one too

Then just map your Image collection into a list of these two types of viewholder and feed that to your recyclerview adapter

Upvotes: 1

Related Questions