如何在Android中保存复选框状态。 条件:如果选中复选框,则单选按钮必须为双拼,反之亦然。如何使用SharedPreferences在Android中保存状态?
//More like an enable-disable button which should save
radioButtons states and then disable/enable them
//RadioButtons states should be saved too
//if radioeg1 was checked when checkbox was checked, its state should
be saved
Eg.
// cb = (Checkbox) findViewById(...)
//radioeg1 = (RadioButton) findViewById(...)
//radioeg2 = (RadioButton) findViewById(...)
if (cb.ischecked){
//save cb state as checked
//radioeg1.setEnabled(false) must be saved
//radioeg2.setEnabled(false) must be saved
//change the RadioButtons textcolor to grey? //Optional but an added Bonus if possible
//if not possible using this way, maybe change a textview's color to grey?
}
最好为代码提供解释! – Sweeper
我是新来的概念,你能提供一个解释吗?我需要用什么来代替“背景”? –