Make EditText ReadOnly

前端 未结 22 1302

I want to make a read-only EditText view. The XML to do this code seems to be android:editable=\"false\", but I want to do this in code.

H

22条回答
  •  佛祖请我去吃肉
    2020-12-04 19:20

    This was the only full simple solution for me.

    editText.setEnabled(false);   // Prevents data entry
    editText.setFocusable(false); // Prevents being able to tab to it from keyboard
    

提交回复
热议问题