0

I read a post (How to make grid-view horizontally scrollable in android) and I tried everything the responses say, but I couldn't manage to make a horizontal gridview with 3 rows.

The closest I could get was using this: https://developer.android.com/reference/android/support/v17/leanback/widget/HorizontalGridView.html , and it has a big bug in which you can't set the number of rows with setNumRows(int) since it makes the horizontalgridview infinitly scrollable vertically.

I also considered the option of rotating a normal gridview 270 degrees but it gives me a lot of problems since I want an all margin of 10dp in the gridview.

And I also tried the TwoWay Gridview of github (https://github.com/jess-anders/two-way-gridview) but it didn't work either.

Same with this video tutorial: https://www.youtube.com/watch?v=94rCjYxvzEE

Please help me.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
TommyTomato
  • 123
  • 2
  • 10

1 Answers1

0

I ended up doing it by using a recycle view and setting a gridlayoutmanager to it.

GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 2, GridLayoutManager.HORIZONTAL, false);
RecyclerView recyclerView = findViewById(R.id.DicesGridView);
recyclerView.setLayoutManager(gridLayoutManager);
DicesElementAdapter adapter = new DicesElementAdapter(this, DiceList, Result, LogsList, gson, sharedPreference);
recyclerView.setAdapter(adapter);
TommyTomato
  • 123
  • 2
  • 10