Reputation: 196
I am loading icons in a recycler view using GridLayout. I am able to scroll the items vertically in a grid. But I want to scroll the items horizontally in the same GridLayout. I am looking for view pager for recycler view or horizontol scroll bars for recycler grid view. Can someone suggest me how this can be achieved? Also if I could use better design than this to achieve the same. That is to load the icons with optimal memory usage.
Upvotes: 4
Views: 5121
Reputation: 1860
The GridLayoutManager has the following Constructor: GridLayoutManager (Context context, int spanCount, int orientation, boolean reverseLayout)
As you can see you can pass an int for the orientation.
One possible option is HORIZONTAL
. This is what you want.
More here: https://developer.android.com/reference/android/support/v7/widget/GridLayoutManager.html
Upvotes: 6