2012-03-08 71 views

回答

0

在我的代码我得到了这样的事情:

InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); 
imm.hideSoftInputFromWindow(password.getWindowToken(), 0); 
imm.hideSoftInputFromWindow(username.getWindowToken(), 0); 

,其中用户名和密码是文字编辑的意见。 并显示:

imm.showSoftInputFromWindow(username.getWindowToken(), 0); 
+0

我试过了,但软键盘仍然弹出了活动的加载事件。 – user874437 2012-03-09 05:13:49

+0

可能关闭了editText的强制重点并将其添加到manifest中的活动:android:configChanges =“keyboardHidden | orientation” – goodm 2012-03-09 10:06:24

0

尝试用这个..

EditText yourEditText= (EditText) findViewById(R.id.yourEditText); 
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); 
imm.showSoftInput(yourEditText, InputMethodManager.SHOW_IMPLICIT); 

,收u可以使用

InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); 
imm.hideSoftInputFromWindow(yourEditText.getWindowToken(), 0); 

这是如何显示和/或如何将其关闭。

因此,当您开始活动时,首先使用关闭代码。

相关问题