Pavel Poley
Pavel Poley

Reputation: 5597

GridLayoutManager how to display different view type on next row

How to configure GridLayoutManager to display different viewtypes in different rows?

For example I have 2 viewtypes and RecycleView displays the following:

[category] [category] [category]
[category] [item] [item]
[item] [item] [item] [item]

And what I want is:

[category] [category] [category]
[category]
[item] [item] [item] [item]
[item] [item]

The structure is very simple, first show categories, then items, if categories ended, jump to next row.

Is there any out of the box configuration for GridLayoutManager to achieve this behavior? or I should write my own LayoutManager?

Upvotes: 1

Views: 299

Answers (1)

Pavel Poley
Pavel Poley

Reputation: 5597

I didn't find out of the box solution so in the end I just added blank [category] to complete the row.

However good solution probably will be custom LayoutManager, but in my case it's over complicated related to the task.

If someone will post solution with LayoutManager I will mark his answer as accepted.

Upvotes: 0

Related Questions