In Android, when I set a background image to a button, I can not see any effect on it when it’s clicked.
I need to set some effect on the button, so the user can recognise that the button is clicked.
The button should be dark for a few seconds when it is clicked. How to do this?
This can be achieved by creating a drawable xml file containing a list of states for the button. So for example if you create a new xml file called "button.xml" with the following code:
To keep the background image with a darkened appearance on press, create a second xml file and call it gradient.xml with the following code:
In the xml of your button set the background to be the button xml e.g.
Changed the above code to show an image (YOURIMAGE) in the button as opposed to a block colour.