Skip to content Skip to sidebar Skip to footer

No Visible Button Feedback After SetEnabled(false) -> (true)/ SelectableItemBackground As Drawable?

With one button i'm disabling three other button's with button.setEnabled(false). That works fine. When this button is pressed again, the tree button's will be enabled with button.

Solution 1:

This is because you are setting the background resource as transparent instead of what you applied in the layout as the background drawable to those buttons. Re-apply those background drawables and you'll get the touch feedback again. That should solve your problem.

On a side note for future implementations you can directly provide the enabled/disabled background resource in the drawable's list-selector itself. use state_enabled = true/false. This eliminates the need of doing all of that in the code.


Post a Comment for "No Visible Button Feedback After SetEnabled(false) -> (true)/ SelectableItemBackground As Drawable?"