将以下内容添加到xml中的Edittext:
安卓的inputType = “textPassword | textNoSuggestions”
或在代码中:
edittext.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_PASSWORD);
那么,对于第一个问题,AFAIK你将文本字段设置为密码模式,而不是键盘,如下所示:
<EditText android:id="@+id/password" android:hint="@string/password_hint" android:inputType="textPassword" ... />
更多信息: https://developer.android.com/training/keyboard-input/style.html
现在,关于防止键盘出现在带有物理键盘的设备上,我建议你检查一下这个答案:
如何防止软键盘弹出?