How can I disable typing in an EditText
field in Android?
You can write edittext.setInputType(0)
if you want to show the edittext but not input any values
you can use EditText.setFocusable(false)
to disable editingEditText.setFocusableInTouchMode(true)
to enable editing;
Assuming editText
is you EditText
object:
editText.setEnabled(false);
The XML editable
property is deprecated since API LEVEL 15.
You should use now the inputType
property with the value none
.
But there is a bug that makes this functionality useless.
Here you can follow the issue status.
The below code disables the EditText in android
editText.setEnabled(false);
To disable a edittext in android:
editText.setEnabled(false);