I have created a selector:
btn_bg.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- pressed -->
<item android:drawable="@drawable/btn_bg_pressed" android:state_pressed="true" />
<!-- focused -->
<item android:drawable="@drawable/btn_bg_focused" android:state_focused="true" />
<!-- default -->
<item android:drawable="@drawable/btn_bg_default" />
</selector>
btn_bg_pressed.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid
android:color="@color/btn_pressed"/>
</shape>
btn_bg_focused.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid
android:color="@color/reality_fix_yellow"/>
</shape>
btn_bg_default.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:width="2dp"
android:color="@color/btn_default_border_color" />
</shape>
I want to change the text color
the button when the focus changes. I've tried adding android:color="color_code"
and android:textColor="color_code"
but failed.
Please help me on How to change the text color of a button with selector?