Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make GridLayoutManager VERTICAL orientation with horizontal scrolling

Tags:

I need the RecyclerView Gridlayout Manager with horizontal scrollable behavior. It must add child views like it does when it has VERTICAL orientation (column wise index for e.g. (row 1, col 1) = index 0, (row 1, col 2) = index 1 and so on).

Currently VERTICAL Orientation does not allow to scroll horizontally and fits child view with in device width.

Edit:

I have 100 rows and 150 columns in RecyclerView GridLayoutManager and need horizontal scrolling of view. I am hiding and showing of rows, which is only possible with VERTICAL Orientation.

like image 369
Gaurav Avatar asked Dec 20 '17 16:12

Gaurav


1 Answers

Try

new GridLayoutManager(getActivity(), 1, GridLayoutManager.HORIZONTAL, false);

Here 1 counts as number of rows. use getActvity() if you work with fragment, and MainActivity.this for example if you re calling it in the activity

like image 135
Rainmaker Avatar answered Nov 15 '22 06:11

Rainmaker