因为它是一个promptView而不是一个Activity,我不能去Manifest来隐藏键盘。 我搜索了谷歌周围,我发现类似的主题,但我无法弄清楚如何把这个工作。Android AlertDialog(promptview)隐藏键盘
LayoutInflater li = LayoutInflater.from(this);
View promptsView = li.inflate(R.layout.prompt_firstime, null);
final EditText nameInput = (EditText) promptsView.findViewById(R.id.prompt_name);
final EditText emailInput = (EditText) promptsView.findViewById(R.id.prompt_email);
InputMethodManager inputManager = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(nameInput.getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY);
inputManager.hideSoftInputFromWindow(emailInput.getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY);
AlertDialog alertDialog = new AlertDialog.Builder(Menu.this).create();
alertDialog.setTitle("Title");
alertDialog.setView(promptsView);
// etc
我在做什么错了?谢谢。
NOP。它继续显示键盘:| – user2902515