我正面临着ListView的问题,我在长时间点击一个项目时尝试创建一个上下文菜单但是当调用OnCreateContextMenuList
事件时我也有OnItemClickListener
event(并且这会触发一个对话框)。
我当前代码的片段:
ListView devicesList = (ListView)getView().findViewById(R.id.devices_list);
devicesList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//Here I create my dialog (I voluntarily hidden the code because I think it doesn't matter (well I think))
});
devicesList.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() {
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
Log.d(TAG, "onCreateContextMenu: yes");
//Here I need to prevent the OnItemClick event to create with serenity my menu
}
});
答案 0 :(得分:0)
您的布局可能有问题。也许某些视图与ListView重叠。