In Android, when I set background image to Button, I can not see any effect on button.
I need some effect on button so user can recognize that button is clicked.
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.
android:background="@drawable/button"
Hope this helps!
Edit: Changed the above code to show an image (YOURIMAGE) in the button as opposed to a block colour.