I read a couple of posts but none of them had the working solution.
Once you do
button.setBackgroundColor(0x00000000);
How do you revert the button's background color back to default color?
By default each activity in Android has a white background. To change the background color, first add a new color definition to the colors.
The color BLUE is reserved for functions of urgent significance. Reset push-buttons must be BLUE, WHITE, GREY or BLACK. If these are also used as STOP/OFF buttons, the colors WHITE, GREY or BLACK are preferred, preferably BLACK. GREEN must not be used.
By default, a button has a white background and black text. Using the CSS background-color property, we can change a button's background color.
use:
btn.setBackgroundResource(android.R.drawable.btn_default);
If the background color was set using
btn.getBackground().setColorFilter(Color.RED, PorterDuff.Mode.MULTIPLY);
it can be reset using:
btn.getBackground().clearColorFilter();
In contrast to button.setBackgroundColor()
setting the color this way preserves the button's shape.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With