Is it possible to have a vertical recycler view with different widths for each row?

247 Views Asked by At

I am creating a recycler view and I have 2 types of itemviews in it. Each item view would have different widths(55dp for one and MatchParent for the another). If I create a recycler view with first 4 rows having width 55dp and the next 2 rows with width MatchParent, do you think my entire recycler view would have same width throughout? Or will it be 55 width for first 4 rows and MatchParent for the last 2 rows? Please note I have set the width and height as wrapContent for the recycler view and using staggeredGridLayoutManager with single column and vertical scroll. I only want a single column vertical scrolling recycler view with different widths at each row.

If you can imagine, it should look like an L - shaped recycler view.

1

There are 1 best solutions below

4
Akash Starvin Dsouza On

Yes, it is possible to have items in RecyclerView to have different height and width.

You should give wrap content for both list item and RecyclerView