的EditText与textPassword inputType下,但没有Softkeyboard [英] EditText with textPassword inputType, but without Softkeyboard
问题描述
我想创造一个与Android的一个EditText:。inputType下=textPassword但是我也不想用SoftKeyboard输入
i wanted to create an EditText with an android:inputType="textPassword. However i also do not want to use the SoftKeyboard for input.
所以我试图设置INPUTMETHOD为空,但这也将禁用更换密码渲染的textPassword功能的 * 的[lastchar]。
So i tried setting InputMethod to null, but this would also disable the textPassword features of replacing password rendering to "*[lastchar]".
是否有任何其他的方式来展示了禁用softKeyboard?
Is there any other way to disable the softKeyboard from showing up?
推荐答案
呃只是理解了它自己:
只需使用:
pinInput.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
InputMethodManager mgr = (InputMethodManager) Pin.this.getSystemService(Context.INPUT_METHOD_SERVICE);
mgr.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
});
这很适合我。我担心这可能会显示SoftKeyboard,然后隐藏它瞬间再次,或闪烁屏幕,但不会像什么也没有。
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.
这篇关于的EditText与textPassword inputType下,但没有Softkeyboard的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!