Simply use the layout_weight on the children of a TableRow or LinearLayout. Give them all a width of 0dip and the same layout_weight (1 for instance.) That's all.
On Fri, Apr 3, 2009 at 2:43 AM, Al Sutton <[email protected]> wrote: > > Given the recent discovery with the cupcake emulator I'm trying to re-work > the layout file so it's cupcake friendly and future proofed, but have hit a > problem. > > What I want is for 6 buttons to take up a total of three quarters of the > screen width, but I can't seem to find the measurement unit which correlates > to this. All I've found is; > > px : Not screen resolution independent, so something that works on a > 320x480 screen won't take 3/4s of the screen on different resolution > display. > > dip : Scales with pixel density and not screen resolution, so the object > won't scale up as the physical screen size gets bigger. > Pt, in & mm : Don't scale with screen size so a 1 unit button is the same > size on a 3 or 30 inch screen. > > sp : Based on font size and there's no guaranteed correlation between font > width and screen width. > > > The closest I've got is the following; > > <TableLayout android:layout_gravity="center_horizontal" > android:layout_height="wrap_content" > android:layout_width="fill_parent"> > <TableRow> > <Button android:id="@+id/button1" > android:layout_width="fill_parent" > android:layout_height="wrap_content"/> > <Button android:id="@+id/button2" > android:layout_width="fill_parent" > android:layout_height="wrap_content"/> > <Button android:id="@+id/button3" > android:layout_width="fill_parent" > android:layout_height="wrap_content"/> > <Button android:id="@+id/button4" > android:layout_width="fill_parent" > android:layout_height="wrap_content"/> > <Button android:id="@+id/button5" > android:layout_width="fill_parent" > android:layout_height="wrap_content"/> > <Button android:id="@+id/button6" > android:layout_width="fill_parent" > android:layout_height="wrap_content"/> > </TableRow> > </TableLayout> > > But this results in buttons with uneven widths which is not what I'm after. > > > Does anyone have a solution? > > Al. > > > --- > > * Written an Android App? - List it at http://andappstore.com/ * > > ====== > Funky Android Limited is registered in England & Wales with the > company number 6741909. The registered head office is Kemp House, > 152-160 City Road, London, EC1V 2NX, UK. > > The views expressed in this email are those of the author and not > necessarily those of Funky Android Limited, it's associates, or it's > subsidiaries. > > > > > > -- Romain Guy Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

