Add views to the right or under depeneding on size of view

3994 views java

Basically, I have a bunch of custom TextViews and a set of data. I programatically inflate the textviews and set their texts according to my data. I want to add my views to the right of each other, and when there is no room horizontally, it will add a new row below. However, I am not sure what layout/view to use to achieve my goal.

Example of what I am trying to achieve: enter image description here

Please Help!

answered question

1 Answer


I would use the Flexbox Layout library from Google. It does exactly this for you.

posted this

Have an answer?


Please login first before posting an answer.