本文介绍了如何将侦听器添加到自动完成文本视图,android?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试添加侦听器,当在 autocompletetextview 上选择一个项目时,它会做出反应......任何人都可以帮忙//phonename 是自动完成文本视图
I am trying to add listener that will react when an item is selected on the autocompletetextview...can anyone help//phonename is the autocompletetextview
PhoneName.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
Toast.makeText(check.this," selected", Toast.LENGTH_LONG).show();
}
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
});
推荐答案
试试这个:
phoneName.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View arg1, int pos,
long id) {
Toast.makeText(check.this," selected", Toast.LENGTH_LONG).show();
}
});
这篇关于如何将侦听器添加到自动完成文本视图,android?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!