lundi 11 mai 2015

How to provide spacing between android Radio Buttons of Vertical orientation

I got a scenario where I need to provide spacing between Radio buttons arranged vertically .
The below is my Layout :

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" 
    android:paddingLeft="20dp"
    android:paddingStart="20dp"
    android:paddingRight="20dp"
    android:paddingEnd="20dp"
   >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="My text view"
        android:textSize="20dp"
        android:textColor="#000000"
        android:gravity="center_vertical"
        android:background="@drawable/roundedlabel"
       />

    <RadioGroup
        android:id="@+id/radioGroup1"
        android:layout_width="152dp"
        android:layout_height="wrap_content"
        android:paddingTop="10dp"
        >

        <RadioButton
            android:id="@+id/radio0"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="text view1"
             android:textSize="20dp"
             android:paddingTop="10dp" 
              />

        <RadioButton
            android:id="@+id/radio1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="20dp"
            android:text="text view2"
          
/>
        <RadioButton
            android:id="@+id/radio2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="20dp"
            android:text="text view3" 
            
            />
   
     <RadioButton
            android:id="@+id/radio3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
             android:textSize="20dp"
             android:text="text v4iew" 
            />
    </RadioGroup>
    

</LinearLayout>


I tried to put android:paddingTop="10dp" for each of the Radio button which takes the Text to bottom , but Radio Button remains on the same position.
can anyone help me how to provide spacing between radio buttons arranged in vertical orientation.

Aucun commentaire:

Enregistrer un commentaire