Prakash Jackson
Prakash Jackson

Reputation: 435

How to reduce space between radiobuttons in a radiogroup in android?

In my app, I have a dialog that contains a radiogroup with four radio buttons. My issue is that it looks good in emulator but when I install and run my app in phone, the radiobuttons get more space between each one of them. This makes the radiogroup stretch outside of my Dialog. Please help me with this. Thank you.

<RadioGroup
        android:id="@+id/radio_RemindAtDlg"
        android:layout_width="wrap_content"
        android:layout_height="130dp"
        android:layout_marginTop="110dp"
        android:layout_marginLeft="20dp" >

        <RadioButton
            android:id="@+id/radio_OnceDlg"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Once"
            android:button="@drawable/radio_button"
            android:textSize="12dp" />

        <RadioButton
            android:id="@+id/radio_WeekDlg"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Every Week"
            android:button="@drawable/radio_button"
            android:textSize="12dp" />

        <RadioButton
            android:id="@+id/radio_MonthDlg"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Every Month"
            android:button="@drawable/radio_button"
            android:textSize="12dp" />

        <RadioButton
            android:id="@+id/radio_YearDlg"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Every Year"
            android:button="@drawable/radio_button"
            android:textSize="12dp" />

    </RadioGroup>

Upvotes: 3

Views: 7263

Answers (2)

Boris Mocialov
Boris Mocialov

Reputation: 3489

Define your own radio buttons with your own sizes, shapes and spaces between components:

http://blog.devminded.com/posts/custom-android-radiobutton

another example

https://stackoverflow.com/a/17693303/1276374

Upvotes: 1

Cob50nm
Cob50nm

Reputation: 961

Without code hard to tell but I would guess that you have the xml height attribute set to fill_parent instead of wrap_content

Upvotes: 0

Related Questions