registerForContextMenu不能正常工作

时间:2018-05-30 13:56:33

标签: android listview

我为自定义列表视图

创建了一个上下文菜单
orderProducts =(ListView) findViewById(R.id.listProductInDoc);
    orderProducts.setChoiceMode(AbsListView.CHOICE_MODE_SINGLE);
    ArrayList<ResultOfProductInDoc> resultOfProductInDoc = GetResultOfProductInDoc();
    orderProducts.setAdapter(new CustomListOfProductInDoc(resultOfProductInDoc,OrderActivity.this));

    View footerView = ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.footer_order, null, false);orderProducts.addFooterView(footerView);
    registerForContextMenu(orderProducts);

但是菜单只显示页脚,当我删除页脚时他也没有工作,有人可以帮助我,这是我的错误。感谢

1 个答案:

答案 0 :(得分:0)

我解决了,问题出在xml布局中。