Why can I type into a disabled EditText?

If I disable an EditText widget using


I can still type into it using the on-screen input method (in both the emulator and on the G1). Is this intended? How can I workaround this issue?

  • How do I run valgrind with an Android app?
  • Left Icon in TextInputLayout
  • Android drawText including text wrapping
  • How to render Android's YUV-NV21 camera image on the background in libgdx with OpenGLES 2.0 in real-time?
  • android.content.res.Resources$NotFoundException for ic_sync_black_24dp.xml
  • Removing and adding activities to the back stack
  • Related posts:

    How can I get zoom functionality for images?
    Renderscript via the support library
    To show a static html page in android
    Android Studio: cannot recover key
    Android ListFragment doesn't save the bundle in onSaveInstanceState()/doesn't retr...
    Cannot make a static reference to the non-static method getSystemService(String) from the type
  • How to tell Gradle to use a different AndroidManifest from the command line?
  • String.format uses comma instead of point
  • GCM Error=MissingRegistration sending messages via JSON
  • Unit Testing MVP using mockito with event listeners
  • How to force overflow menu on android actionbar compat?
  • Design support library - Which version to use with SDK v21
  • 8 Solutions collect form web for “Why can I type into a disabled EditText?”

    I notice that you can’t activate the on-screen keyboard by tapping on a disabled EditText, and also the DEL key doesn’t work, so this looks like a bug to me. I filed it as issue 2771 in the Android issue tracker.


    This will help you

    Use this, it worked for me


    I fixed this issue but the patch only got included in Honeycomb. That’s why I’ve created a little project which will contain my backported fixes to versions starting from 2.1. It contains the fix for bug 2771: http://code.google.com/p/android-fixes/
    You can check out the “library” from the svn and include it in your project. Then instead of android.widget.EditText import edu.ubbdroid.android.widget.EditText (which extends the original EditText) and the problem should be gone 🙂

    Perhaps You could alternatively dynamically substitute with TextView and back. But You would probably need to adjust font to match the EditText.

    if (flag) {
    etComment.setFilters(new InputFilter[] { new InputFilter() {
        public CharSequence filter(
            CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
                if (!flag) {
                    return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
                return null;

    for all
    you can got it!

    I think you should be able to editText.setOnClickListener() with your own function and call super.onClickListener() if you want your text edited.

    Following link has some answers which sound more like the right way:
    Can we have uneditable text in edittext

    For a more up to date answer check this thread:

    How to replicate android editable false

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.