开发者

ToggleButton state change programmatically rather than automatically in Android?

开发者 https://www.devze.com 2023-02-12 02:13 出处:网络
I have created a custom class which extends ToggleButton and I override the toggle method and do not do anything in that. This has helped me in having control of switching togglebutton from on to off.

I have created a custom class which extends ToggleButton and I override the toggle method and do not do anything in that. This has helped me in having control of switching togglebutton from on to off. Is this proper way of doing?

I wanted to have the control of togglebutton switching. I mean it should go from on to off based on certain conditions otherwise it should remain in the state it was.

This way its working but want to know whether its the 开发者_StackOverflow中文版correct way of doing or not.


What you are looking for is ToggleButton.setChecked.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号