2014-09-04 62 views
1

我需要啓用自動建議的edittext。 對於這個我使用下面的XML:Android - 在EditText的鍵盤上獲得自動建議?

<EditText 
        android:id="@+id/edt_description" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:background="@null" 
        android:hint="@string/description_album_hint" 
        android:imeOptions="actionNext" 
        android:inputType="textCapSentences|textAutoCorrect|textAutoComplete" 
        android:maxLines="2" 
        android:minLines="2" 
        android:singleLine="false" 
        android:textColor="@color/black" 
        android:textColorHint="@color/hint_color_light_gray" /> 

即使我加上「textCapSentences | textAutoCorrect | textAutoComplete」爲的inputType仍然沒有建議。

添加截圖(這是我需要實現): enter image description here

請幫助我。 在此先感謝。

+0

默認建議不用擔心建議。 – 2014-09-04 04:54:49

+0

你想在你的編輯文本中自動完成文本? – 2014-09-04 05:02:55

+0

我認爲你需要使用'AutocompleteTextView'。 http://developer.android.com/reference/android/widget/AutoCompleteTextView.html – Aniruddha 2014-09-04 05:07:19

回答

0

如果你想在你的鍵盤上得到自動建議,你所遵循的是正確的。此外,您可以添加android:autoText="true"。該建議會顯示您以前輸入的所有文字。

否則,如果你想得到你鍵入的每個字母的建議,那麼你可以使用AutoCompleteTextView。 這裏是代碼,你可以如何使用它。 Ex - AutoCompleteTextView

+0

android:autoText已被棄用 – Rahul 2014-09-04 05:39:45

0

明白了..... 剛剛從 「textCapSentences | textAutoCorrect | textAutoComplete」 刪除 「textAutoComplete」 爲我工作。