Give all views a width of 0, set the weightSum of the LinearLayout to 100
and set the weight of each child to the percentage you want.

On Oct 8, 2009 1:22 PM, "Mark Wyszomierski" <[email protected]> wrote:


Hi,

Is it possible to create a horizontal LinearLayout where we specify
how wide percentage-wise each element is? Something like:

 LinearLayout ll = new LinearLayout();
 ll.add(new TextView("a"));
 ll.setViewWidthAtIndex(0, 30);
 ll.add(new TextView("b"));
 ll.setViewWidthAtIIndex(1, 50);
 ll.add(new TextView("c"));
 ll.setViewWidthAtIndex(2, 20);

Thanks

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to