我已经将setOnKeyListener添加到AutoCompleteTextView,但是当我按下键时,onKey不会被调用。只有当我按下完成时才会调用... 任何人都可以帮忙吗?onKeyListner没有调用,直到完成按
AutoCompleteTextView userInput = (AutoCompleteTextView) chooseContactView.findViewById(R.id.choose_contact);
userInput.setOnKeyListener(new OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
// TODO Auto-generated method stub
String input = ((AutoCompleteTextView)v).getText().toString();
readContactData(input);
return false;
}
});
你确定你不想文本改变听众? http://developer.android.com/reference/android/widget/TextView.html#addTextChangedListener(android.text.TextWatcher) – Blacklight 2014-11-06 09:13:12