I have a Button in my application. When I use setEnabled(false) on it, it turns grey. However if I first modify the background of the Button and then call setEnabled(false) on it, it does not turn grey (but the Button is not enabled). Why is that and how can I make it grey whatever happens to it?
In my opinion, the easiest solution would be to set the background of the button in your activity. Like the following:
button.setAlpha(.5f);
button.setClickable(false);
.5f alpha is equivalent to grey disable button. It's often useful if the background of your button is an image.
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