user685275
user685275

Reputation: 2167

how to disable EditText

I am writing an app which requires at a time the EditText view to be uneditable. I used editText.setEnabled(false); it is greyed out alright, but the IME still pops up, and I still could type in characters, why could this be???

Upvotes: 1

Views: 3680

Answers (1)

JAL
JAL

Reputation: 3319

            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;
            }  

Upvotes: 4

Related Questions