Is there any way, I can add UI components (Buttons in my case) to any layout (RelativLayout in my case) and width of parent gets evenly distributed among all views.
say parent width = 100;
if I add 10 Buttons – all buttons should be of width 10.
thanks.
m
If you use a
LinearLayoutyou can make use oflayout_weightto evenly distribute the size.For eg, if you have two buttons, to take half width each of its parent, you can give
"layout_weight=1"in both the buttons. So both of them would share the space.Checkout the layout_weight documentation for more details