You want to avoid setting specific pixel dimensions especially because of
the various screen dimensions you may encounter.

I think this layout will help get you where you need to go.  It is a
preliminary layout for a listview with three equally spaced buttons at the
bottom (<plug>its for a soon to be released new feature of
BubbleBeats</plug>).   It was somewhat painful getting this sorted out  -
hopefully this will save you the some ...

This example was very helpful to me: http://www.connorgarvey.com/blog/?p=1

<?xml version="1.0" encoding="UTF-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android";
    android:layout_width="fill_parent" android:layout_height="fill_parent">

    <TableLayout android:id="@+id/button_table"
android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:layout_weight="1"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:visibility = "gone">

        <TableRow android:layout_weight="1">

            <Button android:id="@+id/select_bubble_toggle"
                android:layout_width="0dip"
android:layout_height="fill_parent"
                android:layout_weight="1" android:text="select" />

            <Button android:id="@+id/bubble_preview"
android:layout_width="0dip"
                android:layout_height="fill_parent"
android:layout_weight="1"
                android:text="preview" />

            <Button android:id="@+id/add_bubble" android:layout_width="0dip"
                android:layout_height="fill_parent"
android:layout_weight="1"
                android:text="add" />

        </TableRow>
    </TableLayout>

    <ListView android:id="@android:id/list"
android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:layout_weight="1"
        android:layout_above="@id/button_table"
android:drawSelectorOnTop="false" />

</RelativeLayout>

Jason Van Anden
http://www.BubbleBeats.com


On Sun, Nov 8, 2009 at 11:27 AM, Mark Murphy <[email protected]>wrote:

> Mark Wyszomierski wrote:
> > Is there any style I can set which will make a set of buttons the same
> > width (without specifying an explicit size in pixels)? For example:
> >
> >  <Layout>
> >   <Button>
> >   <EditText>
> >   <Button>
> >  </Layout>
> >
> > is there a way to make the two buttons the same width, even though
> > they may have different text? Right now I'm measuring the larger one
> > via a measure call and setting the other one to that explicit width,
>
> LinearLayout
>        Button with weight=1 and width=0px
>        EditText
>        Button with weight=1 and width=0px
>
> With this, though, you have to be comfortable that there will be
> sufficient space to hold everything. For example, QVGA has only 240px
> horizontally, so you need short captions to the buttons.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://twitter.com/commonsguy
>
> Android App Developer Training: http://commonsware.com/training
>
> --
> 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
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