I use this for my own button to set the background for state pressed and unpressed:
<?xml version="1.0" encoding="utf-8"?>
<item android:drawable="@drawable/btn1_pressed" android:state_pressed="true"/>
<item android:drawable="@drawable/btn1_unpressed"/> <!-- default -->
But I also like the textColor to become white in state pressed.
I tried to just add textColor="#ffffff" to the item but I guess that’s not the correct way, since it did not work.
What would be the best approach without having to code it in each java file that uses this button?
Thanks!
The best is to set Textcolor and Background resource separate.
so your Background: as you wrote it yourself
and Textcolor: