2011-03-25 16 views
5

这是EDITTEXT我已经在布局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"/> 

然而,没有自动完成,没有自动更正后,需要点击我的EditText上并开始打字的地方。我错过了什么?

回答

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"/> 

,在模拟器上它确实没有什么新 - BUUUUT - 在实际设备上自动更正显示出来!

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

+1

这对我不起作用......并且eclipse中的弹出窗口显示autoText已被弃用。 – tomwhipple 2012-01-20 00:25:34

+0

我想你正在编译一个更新的Android - 它看起来像现在应该使用'inputType'来代替。请参阅:http://developer.android.com/reference/android/R.attr.html#autoText – 2012-01-20 21:36:19

0
+1

我想知道它 - 并通过实例搜索 - 但所有示例都显示传入自定义字典。我不想传入字典。我希望应用程序使用手机中已有的字典。 – 2011-03-25 02:53:28

+0

@someone你想用什么词典?也许你可以得到你正在使用的字典,并动态地创建你需要的AutocompleteTextView(上面)的资源? – locoboy 2011-03-25 03:43:09

+0

谷歌在其“消息”应用或Facebook应用使用的任何字典。 – 2011-03-25 03:51:10

10

我有一些问题,自动校正,似乎textAutoComplete意味着输入将是使用应用程序提供的可能值的数组自动完成。因此,它不是android的内置字典,但是例如,您可以提供一个国家/地区列表,用户可以输入前几个字母,而文本将通过匹配项目列表自动完成。

尝试单独使用textAutoCorrect,以及内置的Android词典的建议可能的话,纠正拼写错误等...至少它为我工作...