問題描述
我希望我的 EditText
應該作為 AutoComplete
工作,因為我在 XML 文件中編寫
I want my EditText
should work as AutoComplete
, for that I write in XML file
android:inputType="textAutoComplete|textAutoCorrect"
但它不起作用.
我正在使用 API v2.2 并且我的 Activity 擴展了 MapActivity
,在那里我放置了一個簡單的 EditText
和一個名為搜索"的按鈕.因此,如果我們在 EditText
中輸入位置名稱并按下搜索按鈕,則意味著它應該轉到地圖中的該位置.所以我希望 EditText
可以作為 AutoComplete
工作.我該怎么做?
I am working with API v2.2 and my Activity extends MapActivity
, there I put a simple EditText
and a button named "Search". so if we type the location name in EditText
and press search button means it should go to that location in map.
So I want that EditText
to work as a AutoComplete
.
How can I do that?
推薦答案
只需使用 AutoCompleteTextView
而不是普通的 EditText
.
Just use an AutoCompleteTextView
instead of normal EditText
.
hello-autocomplete 會很有幫助.
上面的鏈接看起來已經過期.新頁面在這里:https://developer.android.com/training/keyboard-input/style#AutoComplete
The above link looks like has expired. The new page is here: https://developer.android.com/training/keyboard-input/style#AutoComplete
這篇關于android EditText 如何作為 AutoComplete 工作的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!