I am asking myself if it is possible, to combine a Spinner
and a AutoCompleteTextView
. Basically I want an AutoCompleteTextView
, that shows all entries from Array
when I click it.
Does anybody know how to do that?
Just found out that this does exactly what I was asking for:
final AutoCompleteTextView textView;
final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(
getActivity(), android.R.layout.simple_dropdown_item_1line,
getResources().getStringArray(R.array.names));
textView = (AutoCompleteTextView) v.findViewById(R.id.txtViewNames);
textView.setAdapter(arrayAdapter);
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View arg0) {
textView.showDropDown();
}
});