Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何判断是否关闭还是开启 #42

Open
zhaoxiuyu opened this issue Sep 27, 2016 · 4 comments
Open

如何判断是否关闭还是开启 #42

zhaoxiuyu opened this issue Sep 27, 2016 · 4 comments

Comments

@zhaoxiuyu
Copy link

如何判断是否关闭还是开启,好像没有方法啊。

@QuRyu
Copy link

QuRyu commented Oct 31, 2016

自己定义一个boolean变量,在与toggleButton绑定的onClickListener中改变boolean 的值;当需要判断开启还是关闭时直接判断boolean变量。

@Pgrammerybj
Copy link

@quentin-l 你这样有一个问题,如果我的这个数据需要做持久化,也就是我要保存住这个按钮的状态,只是自己定义一个变量是行不通的。每一次应用的启动,该Boolean值都会初始化

@dongzhouT
Copy link

建议作者提供一个isChecked()方法,返回当前的toggleOn值。目前获取不到toggleOn的值,很不方便,希望采纳。如下:
public boolean isChecked(){
return toggleOn;
}

@BeyongTheMemory
Copy link

不知道作者是出于什么思路不提供一个获取当前开关状态的方法

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants