How To Work With A ToggleButton Android
I have the following ToggleButton in xml:
Solution 1:
to make the button not clickable, just disable the toggle button:
mToggleButton.setEbabled(false);
or set it not to be clickable:
mToggleButton.setClickable(false);
and for programatically change the button state, use:
mToggleButton.setActivated(true);
mToggleButton.setActivated(false);
Solution 2:
The answer with ToggleButton.setActivated
didn't work for me. I used the following to get it to work:
ToggleButton.setChecked(false);
Hope this helps anyone else with the same issues.
Post a Comment for "How To Work With A ToggleButton Android"