我正在使用这段代码:
spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
Cidade cidade = (Cidade) arg0.getSelectedItem();
List<Bairro> bairros = RachandoTaxiController.getInstancia().getBairros(cidade);
myAutoComplete = (AutoCompleteTextView) getView().findViewById(R.id.completeOrigem);
myAutoComplete.addTextChangedListener(textWatcher);
myAutoComplete.setAdapter(new ArrayAdapter<Bairro>(getActivity(), android.R.layout.simple_dropdown_item_1line, bairros));
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
});
我有一个 Spinner,当我选择一个项目时,我应该根据用户对 Spinner 的选择设置我的 AutoCompleteTextView(来自 holoeverywhere)。如果我静态地这样做,它会起作用。我的自动完成文本视图按预期回答。但是当我将它放入 onItemSelected 时,我的 autocompletetextview 仍然像 edittext.... 没有任何反应... 我该如何解决?