切换按钮的状态变化以编程方式而不是自动的Andr​​oid? [英] ToggleButton state change programmatically rather than automatically in Android?

查看:100
本文介绍了切换按钮的状态变化以编程方式而不是自动的Andr​​oid?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

推荐答案

您要找的是<一个href="http://developer.android.com/reference/android/widget/ToggleButton.html#setChecked%28boolean%29">ToggleButton.setChecked.

这篇关于切换按钮的状态变化以编程方式而不是自动的Andr​​oid?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆