Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a linear layout add a child view in a new line?

Tags:

android

layout

I want to define a layout that it's orientation is horizontal, but if width of the child views exceeds the width, it adds the new child view in a new line.

can it be done?

like image 606
piojo Avatar asked Nov 02 '11 10:11

piojo


2 Answers

For this you will need a FlowLayout whose custom implementation is given on this link

Courtesy : Nishant Nair

http://nishantvnair.wordpress.com/2010/09/28/flowlayout-in-android/

like image 126
ingsaurabh Avatar answered Nov 16 '22 00:11

ingsaurabh


You can use RelativeLayout as the parent view, and put many LinearLayouts in it, giving each of them a separate id, and adjusting their position relative to each other (in your case "below").

like image 31
Ahmad Avatar answered Nov 16 '22 00:11

Ahmad