I am using AutoCompleteTextView
to suggest my list , but i want the suggestions to be inline and not show a drop down list. How can i achieve that ? This is my current code that works as drop down list:
String[] birds = getResources().getStringArray(
R.array.birds_list);
// Create the adapter and set it to the AutoCompleteTextView
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, birds);
mAutoCompleteTextView.setAdapter(adapter);
mAutoCompleteTextView.setThreshold(1);
mAutoCompleteTextView
.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
mAutoCompleteTextView.showDropDown();
}
});
mAutoCompleteTextView
.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId,
KeyEvent event) {
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER))
|| (actionId == EditorInfo.IME_ACTION_DONE)) {
Utils.hideSoftKeyboard(AddMedicationActivity.this);
}
return false;
}
});