RadioButton TextColor 出错了吗?怎么改?

RadioButton TextColor gone wrong? How to change it?

我这里有一个奇怪的问题.. 所以我决定练习像药丸一样制作自定义单选按钮,然后它就不像我编写的那样工作了。

我将文本的颜色设置为黑色和白色,但我的单选按钮文本变成了粉红色?哎呀哟,这是怎么回事?

这是我的代码:

我的广播组:

<RadioButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Rumah"
    android:padding="15dp"
    android:background="@drawable/radio_selector"
    android:button="@drawable/radio_selector_null"
    android:gravity="center"
    android:textColor="@drawable/radio_selector_text"/>

<RadioButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginStart="15dp"
    android:text="Apartemen"
    android:padding="15dp"
    android:background="@drawable/radio_selector"
    android:button="@drawable/radio_selector_null"
    android:gravity="center"
    android:textColor="@drawable/radio_selector_text"/>

<RadioButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginStart="15dp"
    android:text="Kos"
    android:padding="15dp"
    android:background="@drawable/radio_selector"
    android:button="@drawable/radio_selector_null"
    android:gravity="center"
    android:textColor="@drawable/radio_selector_text"/>

radio_selector_null.xml:

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

radio_selector.xml:

<?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/radio_pill_true" />
    <item android:state_checked="false"
        android:drawable="@drawable/radio_pill_false" />
</selector>

radio_pill_true.xml:

<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android">`
    <solid android:color="?colorPrimary" />  <-- Green
    <corners android:radius="50dp" />
</shape>

radio_pill_false.xml:

<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android">`
    <solid android:color="#F3F3F3" />  <-- White
    <corners android:radius="50dp" />
</shape>

radio_selector_text.xml:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_checked="true"
        android:drawable="@color/white" />
    <item android:state_checked="false"
        android:drawable="@color/black_28" />
</selector>
  1. radio_selector_text.xml 文件应该存在于 color/ res 目录中而不是 drawable/ 目录中
  2. 文件中的颜色应使用 android:color="@color/black_28"
  3. 定义