0
我是一個web開發者,並試圖用3個AutoCompleteTextView在Android應用程序中實現一個邏輯。我嘗試了一個AutoCompleteTextView,它正常工作。當我有3個AutoCompleteTextView時,它不起作用。請幫我解決一下這個。兩個或更多的AutoCompleteTextView不工作
這是我的佈局代碼。
<AutoCompleteTextView android:id="@+id/textExecutive"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_executive" />
<AutoCompleteTextView android:id="@+id/textSupervisor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_supervisor" />
<AutoCompleteTextView android:id="@+id/textManager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_manager" />
這是的onCreate
textExecutive = (AutoCompleteTextView) findViewById(R.id.textExecutive);
textSupervisor= (AutoCompleteTextView) findViewById(R.id.textSupervisor);
textManager= (AutoCompleteTextView) findViewById(R.id.textManager);
String[] executives = getResources().getStringArray(R.array.executives_array);
String[] supervisors = getResources().getStringArray(R.array.supervisors_array);
String[] managers = getResources().getStringArray(R.array.managers_array);
ArrayAdapter<String> executivesAdapter =
new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, executives);
ArrayAdapter<String> supervisorsAdapter =
new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, supervisors);
ArrayAdapter<String> managersAdapter =
new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, managers);
textExecutive.setAdapter(celebritiesAdapter);
textSupervisor.setAdapter(eventsAdapter);
textManager.setAdapter(itemsAdapter);
你遇到了什麼樣的錯誤? –
沒有錯誤。自動完成過程不起作用 –
_Not Working_意味着什麼? – Piyush