Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Radio Button: Remove Left padding

Tags:

android

enter image description here

Hello I have an issues as shown above. The problem I am facing is that there appears to be an invisible padding to the left of the radio button as listed above. My question is that is this due to a drawable issue with the radio or can I tweak an attribute to get it to align up with my text and input fields. If I need to use an alternate drawable, is there one I can get from the SDK with no margins / padding?

<LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
... stuff
    <RadioGroup
                android:layout_margin="0dp"
                android:orientation="vertical"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">
                <RadioButton
                    android:id="@+id/radio_free_busy"
                    android:checked="true"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:drawablePadding="0dp"
                    android:text="@string/label_invitation_free_busy"
                    />
                <RadioButton
                    android:id="@+id/radio_free_busy_plus"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/label_invitation_free_busy_plus"
                    />
                <RadioButton
                    android:id="@+id/radio_none"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/label_invitation_none"
                    />
            </RadioGroup>
</LinearLayout>

It seems to be due to the drawable ... if someone has an alternative would be helpful

like image 737
adrian Avatar asked Jul 26 '14 01:07

adrian


1 Answers

You have right. I tried and I added a negative margin left.

This is the result :

enter image description here

This is what I did :

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

<RadioGroup
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="-3dp"
    android:orientation="vertical" >

    <RadioButton
        android:id="@+id/radio_free_busy"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:checked="true"
        android:drawablePadding="0dp"
        android:text="Free busy" />

    <RadioButton
        android:id="@+id/radio_free_busy_plus"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Invitation free busy plus" />

    <RadioButton
        android:id="@+id/radio_none"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Invitation none" />
</RadioGroup>

<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="20dp"
    android:text="Whate name should people in this group see ?" />

like image 57
Farouk Touzi Avatar answered Oct 20 '22 19:10

Farouk Touzi