My RadioButtons in my RadioGroup are leaving a black checked circle after I uncheck them or click on another RadioButton in the group. How do I prevent this from happening?
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Test"
android:textAlignment="textStart"
android:layoutDirection="rtl"
android:layout_gravity="start"
android:background="?android:selectableItemBackground"/>
<RadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="textStart"
android:layoutDirection="rtl"
android:layout_gravity="start"
android:background="?android:selectableItemBackground"/>
</RadioGroup>
Happens on my API 19 real device, not my API 27
Edit:_________________________________________________
Have tried using a custom selector which doesn't work
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/qrmenu_toolbar"
android:orientation="vertical">
<RadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Resume"
android:layoutDirection="rtl"
android:layout_gravity="start"
android:drawablePadding="12dp"
android:paddingStart="16dp"
android:paddingTop="12dp"
android:paddingEnd="16dp"
android:paddingBottom="12dp"
app:drawableLeftCompat="@drawable/ic_resume"
android:button="@drawable/radiobutton_selector"
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/radio_checked" android:state_checked="true" />
<item android:drawable="@drawable/radio_unchecked" android:state_checked="false" />
</selector>
Theme:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorBlack</item>
<item name="colorPrimaryDark">@color/colorBlack</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
Bump still can't find a solution
Edit:______________________________________
Have also tried using custom radio buttons.. still doesn't work:
<RadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:button="@drawable/custom_radio_button"/>
Custom RadioButton:
<?xml version="1.0" encoding="utf-8" ?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:drawable="@drawable/ic_radio_button_checked"/>
<item android:state_checked="false" android:drawable="@drawable/ic_radiobutton_unchecked"/>
</selector>
RadioButton
like for exampleandroid:id="@+id/one"
,android:id="@+id/two"
– Reentry