Android Horizontal LinearLayout - Wrap Elements

Anton picture Anton · Jan 25, 2013 · Viewed 17k times · Source

I have a horizontal linear layout that contains textviews generated dynamically, the problem I'm experiencing is that the textviews are squeezed (see image below) if too many of them are added. How would I go about wrapping the linearlayout so that the textviews are printed on the next line?

enter image description here

Answer

Avinazz picture Avinazz · Jan 25, 2013

LinearLayout cant help with this. Instead you will have make your own Layout as mentioned in this http://nishantvnair.wordpress.com/2010/09/28/flowlayout-in-android/ or incorporate the same approach as of this Android - LinearLayout Horizontal with wrapping children