android - 没有可编辑的小部件时弹出软键盘?

标签 android android-widget android-manifest

我遇到一个问题。当我登录我的应用程序时(从登录页面到主页),主页中没有任何可编辑的小部件,但键盘会自动弹出,我不想这样做, 如何解决?谢谢

最佳答案

来自 Close/hide the Android Soft Keyboard :

You can force Android to hide the virtual keyboard using the InputMethodManager, calling hideSoftInputFromWindow, passing in the token of the window containing your edit field.

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

This will force the keyboard to be hidden in all situations. In some cases you will want to pass in InputMethodManager.HIDE_IMPLICIT_ONLY as the second parameter to ensure you only hide the keyboard when the user didn't explicitly force it to appear (by holding down menu).

关于android - 没有可编辑的小部件时弹出软键盘?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8786102/

相关文章:

android - 具有 20 种不同类型的行的 ListView( Activity 提要),每行有 20 个不同的 View

java - 创建一个 for 循环等待方法返回 true

java - 如何在动画即将结束时加速

java - 启用 ListView 中显示的号码的电话调用

android - 带有联系人照片的联系人列表会造成性能问题

安卓市场过滤问题

java - 您可以限制特定的 Android API 版本从 googlePlay 商店运行/下载应用程序吗?

java - 从字符串中删除特定字符

android - 如何在android中将按钮对齐到正确的位置

android - 在同一设备上运行的单独版本?