0

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.

Reshma
  • 41
  • 6

1 Answers1

0

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

  • I have actually made wrapContent for recycler view but for the itemviews, I strictly want them to be occupying 55dp for first 4 rows and need the last 2 rows to occupy the entire screen width. – Reshma Aug 07 '20 at 11:15
  • List items are same right for both the items? Only the text content is less in second one? – Akash Starvin Dsouza Aug 07 '20 at 11:28
  • Not really. The list items are totally different and also the content in them is. – Reshma Aug 07 '20 at 11:32
  • RecyclerView can bind ONLY one type of item. If you need different item with different contents within in then you should create two different RecyclerView and list items. – Akash Starvin Dsouza Aug 07 '20 at 11:36