㈠ android怎樣用代碼改變EditText的passWord屬性的值
mCheckBoxView = (CheckBox) findViewById(R.id.settings_synch_delet);
mEditTextView = (EditText) findViewById(R.id.account_password);
mCheckBoxView.setOnCheckedChangeListener(checkBox_Listener);
private CheckBox.OnCheckedChangeListener checkBox_Listener = new CheckBox.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView,boolean isChecked) {
if(mCheckBoxView.isChecked()){
//文本正常顯示
mEditTextView.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
Editable etable = mEditTextView.getText();
Selection.setSelection(etable, etable.length());
}else{
//文本以密碼形式顯示
mEditTextView.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
//下面兩行代碼實現: 輸入框游標一直在輸入文本後面
Editable etable = mEditTextView.getText();
Selection.setSelection(etable, etable.length());
}
}
};
希望能幫到你 幫到你了 請採納 謝謝
㈡ CheckBox控制項與Radio Button控制項的差別
Android控制項之CheckBox、RadioButton探究
CheckBox和RadioButton控制項都只有選中和未選中狀態,不同的是RadioButton是單選按鈕,需要編制到一個RadioGroup中,同一時刻一個RadioGroup中只能有一個按鈕處於選中狀態。
以下為CheckBox和RadioButton常用方法及說明:
㈢ android中的isChecked()方法是做什麼用的
這個方法是用於復選框的。即CheckBox對象。區分CheckBox是否被選中,isChecked有兩種返回值:
1 當CheckBox對象的復選框被選中時,isChecked()返回true,即1;
2 當CheckBox對象的復選框沒有被選中時,isChecked()返回false,即0.