While setting setInputType(InputType.TYPE_NULL);
for the password
field, the text we are inputting is visible and will not be masked by
dots which is not desirable for password field.
InputType.TYPE_NULL | TYPE_TEXT_VARIATION_PASSWORD
will display the
keyboard.
If we try setting the content type again as
TYPE_TEXT_VARIATION_PASSWORD
, the virtual keyboard will start
appearing again.
Also tried out the below method which is also not working.
InputMethodManager imm = (InputMethodManager)
getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(editTextPasswordnew.getWindowToken(), 0);
Setting the InputType
to NULL
and setting the TransformationMethod
still displays locale hints.
Can you please suggest any other possible开发者_运维问答 means on how we can achieve
hiding the virtual keyboard on a password EditText
field?
We don't want the user to do it from Settings.
Take a look at android:windowSoftInputMode
tag for activity
element in AndroidManifest.xml
. Especially at stateHidden
and stateAlwaysHidden
values.
But this setting influence behavior of all activity, not just one specific control.
I solved this issue. Add in your manifest file this strings despite the fact that they are deprecated.
android:editable="false"
android:password="true"
精彩评论