That worked perfectly, thank you very much.
On Apr 29, 9:05 pm, Mark Murphy <[EMAIL PROTECTED]> wrote:
> Kyle R wrote:
> > I cannot figure out how to make 4 buttons, arranged vertically in a
> > row, centered both vertically and horizontally on the screen. I don't
> > get why this is so difficult. Is there a complete list of button
> > attributes for the xml file and what they accomplish somewhere?
>
> > What I am trying to achieve would look like:
>
> > <- - - - ->
>
> > 1
> > 2
> > 3
> > 4
>
> > <- - - - ->
>
> Try this:
>
> <?xml version="1.0" encoding="utf-8"?>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
> android:orientation="vertical"
> android:layout_width="fill_parent"
> android:layout_height="fill_parent"
> android:gravity="center"
> >
> <LinearLayout
> android:orientation="vertical"
> android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> android:gravity="center"
> >
> <Button
> android:id="@+id/btn1"
> android:layout_width="300px"
> android:layout_height="50px"
> android:textAlign="center"
> android:padding="15px"
> android:text="1"/>
> <Button
> android:id="@+id/btn2"
> android:layout_width="300px"
> android:layout_height="50px"
> android:textAlign="center"
> android:padding="15px"
> android:text="2"/>
> <Button
> android:id="@+id/btn3"
> android:layout_width="300px"
> android:layout_height="50px"
> android:textAlign="center"
> android:padding="15px"
> android:text="3"/>
> <Button
> android:id="@+id/btn4"
> android:layout_width="300px"
> android:layout_height="50px"
> android:textAlign="center"
> android:padding="15px"
> android:text="4"/>
> </LinearLayout>
> </LinearLayout>
>
> I'll admit I'm not 100% certain why both gravity:"center" attributes are
> needed -- I'd've expected the one on the outer-most LinearLayout would
> have done the trick. But, this seems to give the visual effect you're
> looking for, if I understood you correctly.
>
> --
> Mark Murphyhttp://commonsware.com
> The Busy Coder's Guide to Android Development -- coming in June 2008!- Hide
> quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---