How to define a shape.xml for RadioButton?
I want to create a custom drawable for RadioButton's button drawable.
I have created a theme and style, which points the RadioButton's button drawable to a custom drawable defined in XML.
The drawable.xml looks like this:
<android:shape xmlns:android="http://schemas.android.com/apk/res/android" shape="oval">
<android:solid color="#ffffffff"/>
</android:shape>
But this displays a blank area where the button should have been.
I tried adding a size parameter a开发者_如何学JAVAs well:
<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>
But no luck with that either.
It was a silly mistake on my part! I had missed the android:
namespace qualifier on the color
and other attributes.
The following works fine:
<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>
精彩评论