android - EditText 在我键入时停止显示字符?

标签 android android-edittext

基本上发生的事情是我将开始在键盘上打字(标准和第三方),突然它停止显示我在 EditText 中输入的字符,(有时)将插入符号重置为开头,但我知道我我还在打字,因为建议框会在我打字时显示字符。我在至少 5 种不同的设备以及模拟器上体验过这种行为,但似乎无法确定解决方案。

它看似随机;我没有通过 DDMS 从系统中读取任何错误日志,所以我有点困惑。

Here is what it looks like

这是 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>

这是我在 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;
        }
    });

感谢有关如何解决此问题的任何见解。如果您还需要什么,请告诉我...

谢谢!

编辑:输入法似乎在编辑过程中与 EditText 断开连接。 有时 当它发生时我会收到此警告:WARN/IInputConnectionWrapper(1035): endBatchEdit on inactive InputConnection

最佳答案

另一位开发人员(不是我)可能已经找到了解决方法。查看this comment关于缺陷报告。

关于android - EditText 在我键入时停止显示字符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5988976/

相关文章:

android - 时间戳(firebase)转换错误到日期实用程序

android - Android 中的简单 RichText 编辑器

android - 显示编辑文本的按钮始终为空白(JSON 后台处理给出正确答案后))

android - Android 上的 Chromium webview 和 Chrome 应用程序之间的字体垂直对齐差异

java - Textview文字大小应为editText文字大小并显示在listview中

android - Android 3.0(Honeycomb)如何处理 "paste"事件?

java - Android 编辑文本和对话框

android - 在手机上测试 Android Wear 应用程序?

android - 在 react-native 中取消获取请求

java - 如何去除 Android Material Design 中 TextInputLayout 下的下划线?