Android 状态列表可绘制的自定义单选按钮未更改
我在Android 状态列表可绘制的自定义单选按钮未更改,android,xml,Android,Xml,我在Radio组中有一组单选按钮。我创建了一个可绘制的状态列表,以指示每个按钮的状态。按钮操作正常,选择任何一个按钮都会启动监听器等。但是,状态列表可绘制不起作用。以下是相关资料: 带按钮的布局XML: <RadioButton android:id="@+id/score4" android:layout_width="48dp" android:layout_height="48dp"
Radio组中有一组单选按钮
。我创建了一个可绘制的状态列表
,以指示每个按钮的状态。按钮操作正常,选择任何一个按钮都会启动监听器等。但是,状态列表可绘制
不起作用。以下是相关资料:
带按钮的布局XML:
<RadioButton
android:id="@+id/score4"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginBottom="5dp"
android:button="@drawable/score_button_selector" />
这样会显示默认的单选按钮。此按钮在选中时显示(按钮内为蓝色),但背景不会改变。我知道它看到的是可绘制的score\u按钮\u选择器
,因为它显示的按钮背景为蓝色,仅在可绘制中定义。试试这个
<RadioButton
android:id="@+id/score4"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginBottom="5dp"
android:button="@android:color/transparent"
android:background="@drawable/score_button_selector" />
好的项目clean无法解决任何问题!我认为,也许大多数情况下,作为最后手段,b-4发布一个问题是一个很好的协议。它在追踪鬼魂3天后解决了这个问题。我想你的意思是最后一行有android:button
,而不是android:background
。无论如何。。。没有,我更新了代码。不,最后一行是背景。你需要使按钮透明。仍然没有乐趣。按钮是透明的,但背景不会改变。你的意思是它是蓝色的,但当你点击它时它不会变成绿色?给我发电子邮件告诉我你的代码,这样我就可以看一下了。我的电子邮件在我的个人资料中。
<RadioButton
android:id="@+id/score4"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginBottom="5dp"
android:background="@drawable/score_button_selector" />
<RadioButton
android:id="@+id/score4"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginBottom="5dp"
android:button="@android:color/transparent"
android:background="@drawable/score_button_selector" />