Why can I type into a disabled EditText?

edittext.setKeyListener(null);

This will help you


Use this, it worked for me

setFocusableInTouchMode(boolean);

setFocusable(boolean);

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.


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 :)

Tags:

Android