Until now, when I wanted to stop the user from pressing the button, I would set the button.setClickable(false);
and usually change the text to some kind of grey colour (to let the user know that the button is disabled). Today I stumbled upon the setEnabled()
property.
So I went to the documentation to see the method's explanation below:
setEnabled(boolean enabled)
Set the enabled state of this view.
What does this even mean? What is the difference between enable state/clickable state and disabled state/not clickable state? Could someone please explain what is the difference between doing what I was doing previously, using the clickable property and using the setEnabled()
property? What should be used when? I searched Stack Overflow but could not find anything related.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…