How to use a selector to change an ImageButton image?
How do I make an ImageButton image change its image when you press it? I hope you find this helpful. This can all be done in the XML. 1) Import your images for both pressed and unpressed states into the res/drawable- whichever folder 2) Make your selectors. Right click on a drawable folder and select New/Android xml file. Put in the name eg "ok_button_selector.xml" and choose "selector" as the root element from the menu below. You will need to create a different selector for each button on the screen. 3) In each selector file you need to define the image that will display when clicked, like