EditText自动更正和自动完成无法正常工作

Som*_*ere 5 android

这是我在布局XML中定义的editText:

    <EditText android:id="@+id/msg_text_input"
    android:text="" 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_toLeftOf="@id/msg_button_send" 
    android:imeOptions="actionNone"
    android:inputType="text|textAutoComplete|textAutoCorrect|textShortMessage"/>
Run Code Online (Sandbox Code Playgroud)

但是,单击EditText并开始键入后,没有自动完成并且没有自动更正.我错过了什么?

小智 10

我在自动更正方面遇到了一些问题,而textAutoComplete似乎意味着输入将使用应用程序提供的可能值数组自动完成.所以它不是android的内置字典,但是例如你可以提供一个国家列表,用户可以输入前几个字母,而文本将通过匹配列表项自动完成.

尝试单独使用textAutoCorrect,内置的android字典建议可能的单词,纠正拼写错误等...至少它对我有用...


Som*_*ere 2

我正在尝试并对布局 XML 进行以下更改:

    <EditText android:id="@+id/msg_text_input"
    android:text="" 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_toLeftOf="@id/msg_button_send" 
    android:imeOptions="actionNone"
    android:autoText="true"/>
Run Code Online (Sandbox Code Playgroud)

再说一次,在模拟器上它没有做任何新的事情 - BUUUUT - 在实际设备上自动更正显示!

这个故事的寓意是:在设备上尝试一下,因为模拟器......不太好