32

I want to set the button unclickable and look like a dark gray image of an button?

Is this possible?

Cristian
  • 198,401
  • 62
  • 356
  • 264
user547995
  • 2,036
  • 8
  • 33
  • 62

3 Answers3

79

From the xml:

android:enabled="false"

From the code

button.setEnabled(false);
Cristian
  • 198,401
  • 62
  • 356
  • 264
  • 6
    Note that this will only disable the button, not turn it gray like the original question asked. – Cody Jun 29 '17 at 15:49
4

What about button.setEnabled(false) ?

sstn
  • 3,050
  • 19
  • 32
4

simply set the attribute android:enabled="false" in your xml.

Yahel
  • 8,522
  • 2
  • 24
  • 32