When the user presses my textview, I'd like to make the textview bold. This is what I'm trying:
// styles.xml
<style name="TextOn">
<item name="android:textStyle">bold</item>
</style>
<style name="TextOff">
<item name="android:textStyle">normal</item>
</style>
// my_selector.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:state_pressed="true" style="@style/TextOn" />
<item android:state_focused="false" android:state_pressed="true" style="@style/TextOn" />
<item android:state_focused="true" style="@style/TextOn" />
<item android:state_focused="false" android:state_pressed="false" style="@style/TextOff" />
</selector>
// my textview in a layout
<TextView
...
android:duplicateParentState="true"
android:textAppearance="@drawable/my_selector" />
Setting textAppearance to a selector drawable doesn't seem right, and in fact, it has no effect. How do we do this?
Thanks