2011-03-25 51 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詞典的建議可能的話,糾正拼寫錯誤等...至少它爲我工作...