Ashish
Ashish

Reputation: 371

make layout flexible in Recyclerview

How to Achieve this layout shown in below image Please suggest me how to make layout at run time while my contain is loading directly from web service.

Inshort App Screenshot

Upvotes: 0

Views: 1327

Answers (1)

Muhib Pirani
Muhib Pirani

Reputation: 783

You can use FlexboxLayoutManager for this, here is the snippet

FlexboxLayoutManager layoutManager = new FlexboxLayoutManager();
layoutManager.setFlexWrap(FlexWrap.WRAP);
layoutManager.setFlexDirection(FlexDirection.ROW);
recyclerView.setLayoutManager(layoutManager);

And in Gradle file you will have to compile this dependency

compile 'com.google.android:flexbox:0.3.0-alpha3'

for more you can check this link here

Upvotes: 2

Related Questions