如何为RadioButton定义shape.xml?

问题描述

| 我想为RadioButton的按钮可绘制对象创建一个自定义可绘制对象。 我创建了一个主题和样式,该样式和样式将RadioButton的按钮可绘制对象指向以XML定义的自定义可绘制对象。 drawable.xml如下所示:
<android:shape xmlns:android=\"http://schemas.android.com/apk/res/android\" shape=\"oval\">
  <android:solid color=\"#ffffffff\"/>
</android:shape>
但这会在该按钮应该显示的地方显示一个空白区域。 我也尝试添加大小参数:
<android:shape xmlns:android=\"http://schemas.android.com/apk/res/android\" shape=\"oval\">
  <android:solid color=\"#ffffffff\"/>
  <android:size width=\"16dip\" height=\"16dip\" />
</android:shape>
但也没有运气。     

解决方法

        我这是一个愚蠢的错误!我错过了
color
和其他属性上的
android:
名称空间限定符。 以下工作正常:
<android:shape xmlns:android=\"http://schemas.android.com/apk/res/android\" shape=\"oval\">
  <android:solid android:color=\"#ffffffff\"/>
  <android:size android:width=\"16dip\" android:height=\"16dip\" />
</android:shape>