EditText with textPassword inputType, but without Softkeyboard

后端 未结 1 1477
野趣味
野趣味 2021-01-28 01:24

i wanted to create an EditText with an android:inputType=\"textPassword. However i also do not want to use the SoftKeyboard for input.

So i tried setting InputMethod to

相关标签:
1条回答
  • 2021-01-28 02:01

    Uhm just figured it out myself:

    Simply use:

    pinInput.setOnClickListener(new OnClickListener() {
          public void onClick(View v) {
                InputMethodManager mgr = (InputMethodManager) Pin.this.getSystemService(Context.INPUT_METHOD_SERVICE);
                mgr.hideSoftInputFromWindow(v.getWindowToken(), 0);
          }
        });
    

    This works well for me. I feared it might show the SoftKeyboard and then hide it again instantly, or flicker the screen, but does nothing like it.

    0 讨论(0)
提交回复
热议问题