[英]EditText with textPassword inputType, but without Softkeyboard
i wanted to create an EditText with an android:inputType="textPassword. However i also do not want to use the SoftKeyboard for input. 我想使用android:inputType =“ textPassword创建一个EditText。但是我也不想使用SoftKeyboard进行输入。
So i tried setting InputMethod to null, but this would also disable the textPassword features of replacing password rendering to " * [lastchar]". 因此,我尝试将InputMethod设置为null,但这也将禁用将密码呈现替换为“ * [lastchar]”的textPassword功能。
Is there any other way to disable the softKeyboard from showing up? 还有其他方法可以禁止softKeyboard显示吗?
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.
我担心它可能会显示SoftKeyboard,然后立即将其再次隐藏,或使屏幕闪烁,但是却无济于事。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.