You need to use what is called a selector
.
You can read about them and get a tutorial from this site.
Keep in mind that in Android there really is no such thing as a βfreezeβ because you cannot point your finger at the screen. But you can create selectors, for example, when the button has focus. Typically, a button can have three states: Normal, Focused, and Pressed.
source share