I’ve learned how to tint an image when it’s pressed by adding an OnTouchListener in which I call setColorFilter on the image.
I’ve learned how to use nine-patch images as the background for Buttons and ImageButtons.
The problem is, nine-path images don’t stretch if they’re the src for an ImageButton, and the tint has no effect on the background image.
How can I tint a nine-patch ImageButton when it’s pressed? Any suggestions?
I think you’d have better results by making a separate asset for each button state. For instance, you can make a drawable xml file like this:
Then create a style for your buttons like this:
Then you should be able to style your image buttons and set the src to whatever image you want.