Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add margin between radiobutton ant it's drawable?

This my current layout:

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

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/scrollview"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="#F5F5DC"
    >

        <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
         >

 <RadioGroup
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:orientation="vertical"
  >
  <RadioButton android:id="@+id/radio_red"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
       android:drawableLeft="@drawable/flag_dk"
       android:textColor="#000000"
       android:layout_gravity="center_horizontal"
       android:drawablePadding="10dip"
      android:text="Danish" />
  <RadioButton android:id="@+id/radio_blue"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:drawableLeft="@drawable/flag_en"
      android:layout_gravity="center_horizontal"
      android:layout_marginTop="5dip"

      android:drawablePadding="10dip"
      android:textColor="#000000"
      android:text="English" />
</RadioGroup>


</LinearLayout>
    </ScrollView>

I get this:

enter image description here

I would like to have some space (margin) between radiobutton an the flag (it's drawable). Is it even possible?

like image 796
DixieFlatline Avatar asked Mar 11 '11 09:03

DixieFlatline


1 Answers

In my case, where I have a custom drawable shape, adding android:paddingDrwable attribure did not work but adding android:paddingLeft="5dp" did.

like image 185
vida Avatar answered Oct 19 '22 20:10

vida