How to create custom image buttonfrom the CommonsWare Community archives
At August 28, 2019, 9:31am, Ven asked:
I would like to know the implementation of custom image button
can Push state change be given to image button, kindly help me with this
At August 28, 2019, 10:31am, mmurphy replied:
Sorry, but I do not understand what you mean. I will be out of the office today. If you can explain in greater detail what you mean, I can try to help tomorrow.
At August 28, 2019, 5:00pm, Pvr replied:
How to give Push property to a Button
At August 29, 2019, 12:44am, mmurphy replied:
I am sorry, but I do not know what a “push property” is. Do you mean a piece of data that arrived as part of a message from Firebase Cloud Messaging?
At August 29, 2019, 5:01am, Ven replied:
Push -> state change property given to button
At August 29, 2019, 10:40am, mmurphy replied:
I am sorry, but I do not know how to help you.
At August 30, 2019, 11:39am, Pvr replied:
how to change background color of image button in java code when it is clicked
At August 30, 2019, 12:18pm, mmurphy replied:
If you are asking how to control the color that appears briefly on the button background when it is pressed, you need to create a custom background for your button, in the form of a
<selector> drawable, as we discussed here. Instead of
state_checked, you would configure
If you are asking how to change the button background permanently when it is clicked, call
setBackground() on the
Button, supplying a
Drawable that reflects what you want it to look and behave like after it was clicked. Or, give the
<selector> drawable that also defines what it should look like in
state_activated, then call
setActivated() on the
Button at runtime when you want to switch to that particular background.