Hi,

you can try to add a simple View object between the two Buttons. I  
found this snippet in the Android source code:

<Button
        android:id="@+id/ok_button"
        android:layout_width="150dip"
        android:paddingLeft="6dip"
        android:layout_gravity="left"
        android:layout_weight="0.4"
        android:layout_height="wrap_content" />
<!-- Spacer -->
<View
        android:id="@+id/buttons_spacer_left"
        android:layout_width="0dip"
        android:layout_height="wrap_content"
        android:visibility="gone"
        android:layout_weight="0.2" />
<Button
        android:id="@+id/cancel_button"
        android:layout_width="150dip"
        android:paddingRight="6dip"
        android:layout_gravity="right"
        android:layout_weight="0.4"
        android:layout_height="wrap_content" />

I haven't tried it so I hope it will work ;-)

Lutz

Am 26.01.2009 um 17:55 schrieb Inderjeet Singh:

>
> Hi,
>
> I am probably missing something totally obvious, but can someone tell
> me how to add padding between buttons of a LinearLayout?
>
> Here is the code fragment from my layout xml file.
>  <LinearLayout
>    xmlns:android="http://schemas.android.com/apk/res/android";
>    android:orientation="horizontal"
>    android:gravity="center"
>    android:layout_width="fill_parent"
>    android:layout_height="wrap_content">
>
>    <Button android:id="@+id/first_button"
>      style="@style/ButtonText"
>      android:layout_width="wrap_content"
>      android:layout_height="wrap_content"
>      android:paddingLeft="10px"
>      android:paddingRight="10px"
>      android:text="First"/>
>
>    <Button android:id="@+id/second_button"
>      style="@style/ButtonText"
>      android:layout_width="wrap_content"
>      android:layout_height="wrap_content"
>      android:paddingLeft="10px"
>      android:paddingRight="10px"
>      android:text="Second"/>
>  </LinearLayout>
>
> The buttons still appear closer together than what I would prefer. How
> do I increase the spacing between the "First" and "Second" buttons?
>
> Thanks
> Inder
>
> >
>


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

Reply via email to