我想问一下如何在listview下切换并只选择一个事件。我下面的代码正在运行。但是当 OnItemLongClick 触发时, OnItemClick 也会触发。如何切换仅检测到一个事件的事件:
lstResult.setOnItemClickListener(new OnItemClickListener()
{
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position,
long arg3) {
// TODO Auto-generated method stub
//showToast(arg0.getItemIdAtPosition(position) + "");
String str = searchWhere(lstResult.getItemAtPosition(position) + "");
String word = lstResult.getItemAtPosition(position).toString();
showDialog(word,str);
}
});
lstResult.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
// TODO Auto-generated method stub
showToast(lstResult.getItemAtPosition(position) + "");
return false;
}
});