There is an xml file in which I change the color of the button, depending on its state:

 <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@color/colorPrimaryDark" android:state_pressed="true"/> <item android:drawable="@color/colorPrimary" android:state_focused="true"/> <item android:drawable="@color/transparent"/> </selector> 

Everything works fine, but still need to change the text color of the buttons
How to do it?

    1 answer 1

    Try to write the same selector, put it in res / color and set it as a parameter:

     android:textColor="@color/selector"