I have the following code for a button in the layout file for my application
What you need is selector, its a simple drawable file in which you can change colors for example of your button depending of its state, for example: