In my Android app I've got a couple radion buttons which should get a different color and become bold upon selection. I managed to get the different color by defining a radio_pick_color.xml file in drawable:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- checked -->
<item android:state_checked="true"
android:color="#00FF15" />
<!-- default -->
<item android:color="#4000FF" />
</selector>
and referencing this file in my main.xml file:
android:textColor="@drawable/radio_picker_color"
I now want to do the same for having the text bold. So I made another file called radio_picker_style.xml in which I wanted to define the style like this:
<item android:state_checked="true"
android:style="bold" />
Unfortunately eclipse complaints that no resource identifier can be found for attribute 'style' in package 'android'. I also tried with android:textStyle, but from within a selector item it also doesn't know the android:textStyle
attribute.
Does anybody know how I can get the selected radio button in bold?
==EDIT== The relevant part of my main.xml file:
<RadioGroup
android:id="@+id/radioGroup2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<RadioButton
android:id="@+id/option_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/option_1"
android:textColor="@drawable/radio_picker_color"
/>
<RadioButton
android:id="@+id/option_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/option_2"
android:textColor="@drawable/radio_picker_color"
/>
</RadioGroup>
And the radio_picker_style.xml which I tried to put in drawable folder, but which says "Attribute is missing the Android namespace prefix":
<?xml version="1.0" encoding="utf-8"?>
<style name="mystyle">
<item name="android:textColor">#ffffff</item>
<item name="android:textStyle">bold</item>
</style>