Question

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>
Was it helpful?

Solution

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

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top