ToggleButton state change programmatically rather than automatically in Android?

≡放荡痞女 提交于 2019-12-18 07:45:20

问题


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 correct way of doing or not.


回答1:


What you are looking for is ToggleButton.setChecked.



来源:https://stackoverflow.com/questions/5041021/togglebutton-state-change-programmatically-rather-than-automatically-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!