当我键入时,EditText 停止显示字符?
基本上发生的情况是我将开始在键盘上输入(股票和第三方),突然间它停止显示我在 EditText 中输入的字符,(有时)将插入符号重置为开头,但我知道我仍然键入,因为建议框会显示我键入的字符。我已经在至少 5 种不同的设备以及模拟器上经历过这种行为,但似乎无法确定解决方案。
看似随机,实则不然。我没有通过 DDMS 从系统读取任何错误日志,所以我有点困惑。
这是 EditText 的 XML 布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:transcriptMode="alwaysScroll"/>
<EditText android:id="@+id/etMain"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="text|textAutoCorrect"
android:imeOptions="actionSend">
<requestFocus />
</EditText>
</LinearLayout>
这是我的代码活动:
et = (EditText) findViewById(R.id.etMain);
et.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || actionId == EditorInfo.IME_ACTION_SEND) {
String sendText = v.getText().toString();
if (sendText.length() > 0) {
v.setText("");
....
}
}
return true;
}
return false;
}
});
感谢有关如何解决此问题的任何见解。如果您还需要什么,请告诉我...
谢谢!
编辑: 看起来输入方法在编辑过程中与 EditText 断开了连接。 有时发生这种情况时我会收到此警告:WARN/IInputConnectionWrapper(1035): endBatchEdit on inactive InputConnection
Basically what happens is I will start typing on the keyboard (stock and third party), and all of a sudden it stops showing characters I type in the EditText, (sometimes) resets the caret to the beginning, yet I know I'm still typing because the suggestions box shows the characters as I type. I've experienced the behavior on at least 5 different devices as well as the emulator but can't seem to nail down a solution.
It is seemingly random; I'm not reading any error logs through DDMS from the system, so I'm a little baffled.
Here is the XML layout of the EditText:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:transcriptMode="alwaysScroll"/>
<EditText android:id="@+id/etMain"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="text|textAutoCorrect"
android:imeOptions="actionSend">
<requestFocus />
</EditText>
</LinearLayout>
And here is my code from the Activity:
et = (EditText) findViewById(R.id.etMain);
et.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || actionId == EditorInfo.IME_ACTION_SEND) {
String sendText = v.getText().toString();
if (sendText.length() > 0) {
v.setText("");
....
}
}
return true;
}
return false;
}
});
Appreciate any insights on how to fix this issue. Let me know if you need anything else...
Thanks!
EDIT: It almost seems like the inputmethod is disconnecting from the EditText in the middle of an edit. Sometimes I will get this warning when it happens: WARN/IInputConnectionWrapper(1035): endBatchEdit on inactive InputConnection
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
另一位开发人员(不是我)可能已经找到了解决方法。查看缺陷报告中的此评论。
Another developer (not me) may have found a workaround for this. Check out this comment on the defect report.