Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make EditText that cannot be editted? [duplicate]

I am trying to make the editText that shows the text but not as editable type. I cant use textview there because i am using same component for entering the values. How to achieve it? Any help is really appreciated and thanks in advance.

like image 991
Pattabi Raman Avatar asked Sep 20 '11 04:09

Pattabi Raman


People also ask

How do you make EditText Uneditable?

android:editable="false" should work, but it is deprecated, you should be using android:inputType="none" instead. Alternatively, if you want to do it in the code you could do this : EditText mEdit = (EditText) findViewById(R. id.


2 Answers

editText.setFocusable(false); editText.setClickable(false); the two property which turn EditText to non focusable and unclickable which leads to a non editable Edittext

like image 98
Mohammed Azharuddin Shaikh Avatar answered Oct 08 '22 11:10

Mohammed Azharuddin Shaikh


Make EditText Read only.

Like this:

android:enabled="false"

Or from code: edittext.setEnabled(false) or edittext.setFocusable(false) or edittext.setFocusableinTouchMode(false)

like image 35
Awais Tariq Avatar answered Oct 08 '22 10:10

Awais Tariq