31

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

Is this possible?

Cristian
  • 196,304
  • 62
  • 355
  • 262
user547995
  • 1,956
  • 8
  • 33
  • 59

3 Answers3

77

From the xml:

android:enabled="false"

From the code

button.setEnabled(false);
Cristian
  • 196,304
  • 62
  • 355
  • 262
  • 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,024
  • 18
  • 30
4

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

Yahel
  • 8,464
  • 2
  • 23
  • 32