-1

How to align RecyclerView items. I am using ChipsLayoutManager so that i can get items side by side it is working but it is leaving lots of space and i want the next item to be continue where the first end.

Here is the code:

ChipsLayoutManager chipsLayoutManager = ChipsLayoutManager.newBuilder(Quran_e_Kareem.this)
                //a layoutOrientation of layout manager, could be VERTICAL OR HORIZONTAL. HORIZONTAL by default
                .setOrientation(ChipsLayoutManager.HORIZONTAL)
                // row strategy for views in completed row, could be STRATEGY_DEFAULT, STRATEGY_FILL_VIEW,
                //STRATEGY_FILL_SPACE or STRATEGY_CENTER
                .setRowStrategy(ChipsLayoutManager.STRATEGY_DEFAULT)
                // whether strategy is applied to last row. FALSE by default
                .build();
        listView.setLayoutManager(chipsLayoutManager);

I am getting output like this

But i want to get this way

Any help is appreciated.

  • Simple use [`FlexboxLayoutManager`](https://github.com/google/flexbox-layout) for sample check this https://stackoverflow.com/a/49973416/7666442 && https://stackoverflow.com/a/50411183/7666442 – AskNilesh Feb 26 '19 at 05:27
  • **Please don't repeat questions.** Simply editing this post with any new information you had, any new code you'd tried, or an explanation of why any posted answers didn't work, would've bumped it to the top of the active queue. I've closed this as a duplicate of the newer one, since you seem to have gotten your solution there, but, in the future, please just edit the original. – AskNilesh Feb 26 '19 at 05:33
  • I get my answer but still having some issue in it so i ask again – syed raheem Feb 26 '19 at 05:38

1 Answers1

0

this will help you

   ChipsLayoutManager chipsLayoutManager = ChipsLayoutManager.newBuilder(this)
                        .setOrientation(ChipsLayoutManager.HORIZONTAL)
                        .build();