Fabian
Fabian

Reputation: 835

RecyclerView - GridLayoutManager - scroll in both directions

currently I'm looking for an GridLayoutManager for the RecyclerView with which I can scroll in both directions. It should have an fixed number of columns. But if those columns are too width, there should be an scrollbar with which I can scroll horizontal.

The number of rows is undefined and should be calculated based on the number of items.

I created a small picture to clarify what I mean. picture to clarify what I mean

I already searched on google, but until now I could not find anything, which fits my requirements. Is there anybody who knows such a layoutmanager?

My current solution is to wrap an HorizontalScrollView around the RecyclerView. And I already created a subclass of GridLayoutManager and override canScrollHorizontal() and canScrollVertical(). But this doesn't work.

Upvotes: 2

Views: 3773

Answers (1)

nshmura
nshmura

Reputation: 6010

Try this project: https://github.com/devunwired/recyclerview-playground

There is FixedGridLayoutManager.

enter image description here

Upvotes: 4

Related Questions