Android 4.2 do not display RadioButton correctly when android:drawableLeft is used. drawableRight is OK.
The drawable on the left side overlaps the Radio button graphic. And at least Android 2.2-4.1 seem to be OK with drawableLeft.
Do you know about workaround for this? Setting drawableLeft programatically did not work to solve this issue.
4.2 Android issue
4.1 Android renders this correctly (also at least Android 2.2-4.0 render this correctly too)
The Android XML layout Code for this:
<RadioButton
android:id="@+id/radio_cloud_dropbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:drawableLeft="@drawable/dropbox_logo"
android:checked="true"
android:text="@string/lbl_cloud_dropbox" />
you can use at radio button :
set the button @null and the drawable left set that your button:
<RadioGroup
android:id="@+id/hn_radio_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RadioButton
android:id="@+id/rb_Select_by_proposal"
style="@style/RadioButtonText"
android:checked="true"
android:tag="1"
android:text="@string/select_by_proposal" />
<RadioButton
android:id="@+id/rb_Select_by_first_letter"
style="@style/RadioButtonText"
android:tag="2"
android:text="@string/select_by_first_letter" />
</RadioGroup>
and this the style:
<style name="RadioButtonText">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:button">@null</item>
<item name="android:drawableLeft">@drawable/radio_selector</item>
<item name="android:drawablePadding">10dp</item>
</style>
for space between the button and the text use at:
<item name="android:drawablePadding">10dp</item>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With