1
我在android中有一個自定義單選按鈕。 它的工作很好。我的問題是,當我禁用這些按鈕時,它不會變灰。我該怎麼做?這是我的自定義單選按鈕的示例代碼。Android應用中的自定義單選按鈕在禁用時不會灰顯
<?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_select" />
<item android:state_checked="false" android:drawable="@drawable/radio_holo" />
</selector>
下面是代碼,我在我的佈局中使用
,我需要的文本外觀小巧和普通文本的顏色黑色<RadioButton
android:id="@+id/radioButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:button="@drawable/custom_radio_button"
android:onClick="OnClick"
android:text="button 1"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/black" />
一件事。
我需要變灰的文字不是按鈕。 –