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
<- - - - ->
I would like a vertical spacing of about 15 pixels per button. The
xml code I've got looks like the following, which doesn't work at all.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:id="@+id/btn1"
android:layout_width="300px"
android:layout_height="50px"
android:textAlign="center"
android:gravity="center_horizontal"
android:padding="15px"
android:text="1"/>
<Button
android:id="@+id/btn2"
android:layout_width="300px"
android:layout_height="50px"
android:textAlign="center"
android:gravity="center_horizontal"
android:padding="15px"
android:layout_below="@id/btn1"
android:text="2"/>
<Button
android:id="@+id/btn3"
android:layout_width="300px"
android:layout_height="50px"
android:textAlign="center"
android:gravity="center_horizontal"
android:padding="15px"
android:layout_below="@id/btn2"
android:text="3"/>
<Button
android:id="@+id/btn4"
android:layout_width="300px"
android:layout_height="50px"
android:textAlign="center"
android:gravity="center_horizontal"
android:padding="15px"
android:layout_below="@id/btn3"
android:text="3"/>
</RelativeLayout>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---