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?

  • Simulate no network using Retrofit and MockWebServer
  • Status says Draft in Prod
  • insert separator between view-pager
  • Filtering Logcat Logs on commandline
  • Java dependency injection: Dagger 1 vs Dagger 2, which is better?
  • Service that runs every minute
  • Related posts:

    Disable swiping between tabs
    How to make your Android app auto update
    Coloring the Space widget
    Require Gradle project from another directory
    Blurry SVG images in chrome for Android
    How do you render text in an android layer-list xml file?
  • ActionBar 'up' button destroys parent activity, 'back' does not
  • How can I launch the 'Add Contact' activity in android
  • How to enforce EditText to start text in capital letter?
  • Google Map on Android do not load
  • Picasso Does Not Preserve Aspect Ratio While Resizing Image
  • Android playing resource files from internal storage causes MediaPlayer.prepare to give IOException
  • 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.