I am working on a dialog at Android with a few EditText
s.
I've put this line at the onCreate()
in order to disable the soft keyboard:
Keypad.this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
The problem is that it works only when the dialog appear and doing nothing.
When I move to the next EditText
, the keyboard appears and not going down.
Does anybody have an idea how to solve this issue?
Its been some time since this post, but here is a simple method which worked for me: in the xml, in the
EditText
properties, do:android:focusable="false"
. Now the keyboard will not popup even if the user clicks on it. This is useful if you are providing your own keypad.by set EditText focusable->false, keyboard will not opened when clicked
If you put the textViews in the view group you can make make the view get the focus before any of its descendants by using this:
You can do that:
It will disable the keyboard to the textView and the click will not work anymore.
Call
TextView.setShowSoftInputOnFocus(false)
. This method is documented since API level 21, but it's already there since API level 16 (it's just hidden from JavaDoc). I use it with API level 16 in an AlertDialog in combination withdialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN)
.In API level 14, there is a hidden method
setSoftInputShownOnFocus()
which seems to have the same purpose, but I have not tested that.The advantage over
InputType.TYPE_NULL
is, that all the normal input types can be used (e.g. for password input) and the touch event positions the cursor at the correct spot within the text.