3

I have a radio button in my app with a custom shape set as its background.Now I see 2 circles,,default and the custom.I tried to use android:button=@null.It removes entire background.Is there any other way to remove the deafault radiobutton circle.Below is my Xml file.

Radiobutton.xml:

RadioButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:scaleX="0.3"
    android:scaleY="0.3"
    android:button="@android:color/transparent"
     android:background="@drawable/radio_selector"
    android:id="@+id/radio1"/>

radio_selector.xml:

<?xml version="1.0" encoding="utf-8"?>
<selector
    xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:drawable="@drawable/radio_check"
        android:state_checked="true" />
    <item
        android:state_checked="false"
        android:drawable="@drawable/radio_uncheck"
        >

    </item>
</selector>

radio_uncheck.xml:

<?xml version="1.0" encoding="utf-8"?>
<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
    <solid
        android:color="#ffffff"></solid>
    <stroke
        android:color="#bb2b67"
        android:width="2dp"></stroke>
</shape>

radio_check.xml:

<?xml version="1.0" encoding="utf-8"?>
<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
    <solid
        android:color="#bb2b67">
    </solid>
</shape>
jobin
  • 1,489
  • 5
  • 27
  • 52

1 Answers1

0

I used the below solution when I got stuck with this type of issue :-

<RadioButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:scaleX="0.3"
    android:scaleY="0.3"
    android:button="@drawable/radio_uncheck"
    android:id="@+id/radio1"/>
Shalu T D
  • 3,921
  • 2
  • 26
  • 37