切换按钮的状态变化以编程方式而不是自动的Andr​​oid?而不是、按钮、状态、方式

2023-09-12 10:20:05 作者:用心交友ゞ用钱交狗

我创建延伸切换按钮和我重写切换方法,不要做任何事情的自定义类。这帮助我在具有从开到关开关切换按钮控制。做这种正确的方法是什么?

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.

推荐答案

您要找的是ToggleButton.setChecked.