문제

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>
도움이 되었습니까?

해결책

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

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top