安卓软键盘不工作

标签 android keyboard

我遇到了影响软键盘正常工作的奇怪问题。

我的应用程序中没有单个 EditText View ,也没有以某种方式使用键盘,但不知何故,在将我的应用程序安装到多个设备上后,使用它然后返回使用该设备软键盘停止工作,这让我发疯......

用户看到的是,当他/她单击软键盘中的字符按钮时,每个应用程序的 EditText 中都没有显示任何内容。就像我说的那样,奇怪的问题会影响整个系统,用户无法编写任何内容。

我的应用程序包含所有类型的功能,所有功能都使用标准的 API,所以我不明白如何导致或至少触发它。

当键盘不工作并且用户点击键盘按钮时,您可以在 logcat 中看到:

WARN/IInputConnectionWrapper(1628): sendKeyEvent on inactive InputConnection
WARN/IInputConnectionWrapper(1628): getCursorCapsMode on inactive InputConnection
WARN/IInputConnectionWrapper(1628): endBatchEdit on inactive InputConnection

InputConnection 如何变为非 Activity 状态,有没有办法激活它?

我想知道是否有人遇到过这种问题,是什么原因造成的?

最佳答案

看起来您的输入连接没有正确关闭。我遇到了类似的问题并通过以下方式修复了它:

EditText editTextLogin = (EditText) findViewById(R.id.editTextLogin);
editTextLogin.requestFocus();
InputMethodManager inputManager = (InputMethodManager)context.getSystemService(INPUT_METHOD_SERVICE);
inputManager.restartInput(editTextLogin);

关于安卓软键盘不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7266679/

相关文章:

android - SharedPreference 或 Map<String, SoftReference<Bitmap>>

android - 如何使锐渐变可绘制

android - Wire protocol buffers 与 Cap'n proto - 哪个更好?

ios - UIButton 像苹果键盘一样扩展触摸区域

android - Genymotion 卡在黑屏

java - Android 头显 "NASA daily image App"

ios - 使用 Swift 使用键盘向上移动 TextView

Linux input.h(我将在 .NET 中链接到什么库)

iphone - 显示和隐藏键盘时调整表格 View 的大小

java - 单击 EditText 时键盘不显示