android 设置EditText可输入和不可输入状态

//设置EditText可输入和不可输入状态
private void editTextable(EditText editText, boolean editable) {
    if (!editable) { // disable editing password
        editText.setFocusable(false);
        editText.setFocusableInTouchMode(false); // user touches widget on phone with touch screen
        editText.setClickable(false); // user navigates with wheel and selects widget
    } else { // enable editing of password
        editText.setFocusable(true);
        editText.setFocusableInTouchMode(true);
        editText.setClickable(true);
    }
}

你可能感兴趣的:(android)