how to disable EditText
I am writing an app which requires at a time the EditText view to be uneditable. I used editText.setEna开发者_运维百科bled(false); it is greyed out alright, but the IME still pops up, and I still could type in characters, why could this be???
if (cbProhibitEditPW.isChecked()) { // disable editing password
editTextPassword.setFocusable(false);
editTextPassword.setFocusableInTouchMode(false); // user touches widget on phone with touch screen
editTextPassword.setClickable(false); // user navigates with wheel and selects widget
isProhibitEditPassword= true;
}
else { // enable editing of password
editTextPassword.setFocusable(true);
editTextPassword.setFocusableInTouchMode(true);
editTextPassword.setClickable(true);
isProhibitEditPassword= false;
}
精彩评论