Android numeric password field

后端 未结 8 1683
春和景丽
春和景丽 2020-12-05 00:15

I have an EditText field which needs to be a numeric password field. Everything works OK in portrait mode; not in landscape. When the user selects the EditText field, the UI

8条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-05 00:32

    To fix the issue where the password is visible in the landscape mode full-screen editor (as Marcus described), you can add the following line to disable the full-screen editor:

    editText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
    

    You may also want to change the typeface to monospace to better emulate the text-password behavior:

    editText.setTypeface(Typeface.MONOSPACE);
    

提交回复
热议问题