I'm trying to make a custom RadioButton like this:
I tried making a RadioGroup with three RadioButton in it with the background of the RadioGroup being a rectangle and the background of the RadioButton would be a blue rectangle when checked and white when not but it doesn't seem to be working.
<RadioGroup
android:id="@+id/Frequency"
android:layout_width="370dp"
android:layout_height="40dp"
android:background="@drawable/radiorectangle"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.614">
<RadioButton
android:id="@+id/Dailyrb"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:checked="true"
android:text="Daily" />
<RadioButton
android:id="@+id/Weekly"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Weekly" />
<RadioButton
android:id="@+id/Monthly"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Monthly" />
</RadioGroup>
The Button
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" >
<shape android:shape="rectangle">
<solid android:color="@color/clearBlue">
</solid>
<corners android:radius="16dp"></corners>
</shape>
</item>
<item android:state_checked="false" >
<shape android:shape="rectangle">
<solid android:color="@color/white">
</solid>
<corners android:radius="16dp"></corners>
</shape>
</item>