jjzjj

hideSoftInputFromWindow

全部标签

android - 在没有任何键盘操作的情况下隐藏软键盘

我有一个选项卡View,每个选项卡有一个Activity,当我从第一个选项卡(有一个TextView)切换到第二个选项卡(它只显示一个可点击列表)时,软键盘仍然存在。我想让它消失,所以我尝试了这个:publicstaticvoidhideSoftKeyboard(Activityactivity,Viewview){InputMethodManagerimm=(InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE);imm.hideSoftInputFromWindow(view.getWin

Android更改 fragment 时隐藏键盘

当我改变fragment时。我正在使用它来关闭键盘,因为屏幕上有一个EditText字段。我只是觉得必须有更好的方法,但我还没有发现任何关于检测键盘是否在屏幕上的方法。Activityactivity=getActivity();InputMethodManagerinputMethodManager=(InputMethodManager)activity.getSystemService(Activity.INPUT_METHOD_SERVICE);try{inputMethodManager.hideSoftInputFromWindow(activity.getCurrentF

Android 隐藏键盘不起作用 - 无法隐藏软键盘

我正在DroidIncredible上开发(并且也在1.5AVD模拟器上进行了测试),我的选项卡小部件中的一个选项卡由一个ListView和一行带有EditText和一个发送按钮(用于聊天功能)。单击“发送”后,我使用以下方法关闭软键盘,但它不起作用。这与我在其他地方发现的人们认为正确的代码相同。看到我遗漏了什么吗?//inButton'sonClick():EditTextchatTextBox=(EditText)findViewById(R.id.chat_entry);//Handlebuttonclick...chatTextBox.setText("");InputMeth

android - hideSoftInputFromWindow 不起作用?

对于某些EditTextView,我想使用自定义键盘而不是软键盘。问题是当我第一次点击EditText时,两个键盘都会显示。当我第二次点击时-软键盘终于消失了。这种行为的原因可能是什么?这是我使用的代码:packagepkleczek.profiwan.keyboards;importandroid.app.Activity;importandroid.inputmethodservice.KeyboardView;importandroid.text.InputType;importandroid.view.View;importandroid.view.View.OnClickLi

android - hideSoftInputFromWindow 出现空指针错误

我在这一行得到一个空指针异常:publicvoidhideKeyboard(){InputMethodManagerinputManager=(InputMethodManager)this.getSystemService(Context.INPUT_METHOD_SERVICE);inputManager.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(),InputMethodManager.HIDE_NOT_ALWAYS);}这是从以下方法调用的:@OverridepublicvoidonBackPre