我有一个列表视图,在其中我实现了onItemClick和onItemLongClick。列表视图行是自定义的,其中有在ItemClick发生时选中的复选框。现在WHen用户进行了长点击,我仍然得到一个ItemClick,它选择了复选框,当用户试图做其他事情时,这看起来很奇怪。
如何修复此
为列表视图设置一个OnItemLongClickListener。
getListView().setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) {
/*Make sure to return true so that the event will be consumed here, and not
propogated to the onListItemClick listener.*/
return true;
}
});
请在此处查看类似的答案。