honey_ramgarhia
honey_ramgarhia

Reputation: 567

GridLayoutManager populates items vertically

I want a horizontal scrollable gridview. So I'm using RecyclerView with GridLayoutManager. Here is my GridLayoutManager

GridLayoutManager(this, 2, GridLayoutManager.HORIZONTAL, false)

The problem is it populates items like this

1 3 5

2 4 6

but I want it this way

1 2 3

4 5 6

Is there any way to do this?

Upvotes: 0

Views: 266

Answers (1)

Jaymin Soni
Jaymin Soni

Reputation: 116

Use this code

recyclerView.setLayoutManager(new GridLayoutManager(this, 3));

Upvotes: 1

Related Questions