-
Notifications
You must be signed in to change notification settings - Fork 680
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
Comments
自己定义一个boolean变量,在与toggleButton绑定的onClickListener中改变boolean 的值;当需要判断开启还是关闭时直接判断boolean变量。 |
@quentin-l 你这样有一个问题,如果我的这个数据需要做持久化,也就是我要保存住这个按钮的状态,只是自己定义一个变量是行不通的。每一次应用的启动,该Boolean值都会初始化 |
建议作者提供一个isChecked()方法,返回当前的toggleOn值。目前获取不到toggleOn的值,很不方便,希望采纳。如下: |
不知道作者是出于什么思路不提供一个获取当前开关状态的方法 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
如何判断是否关闭还是开启,好像没有方法啊。
The text was updated successfully, but these errors were encountered: