Android将列表视图添加到选项菜单

Android将列表视图添加到选项菜单,android,listview,options-menu,Android,Listview,Options Menu,我想在“选项”菜单中添加一个ListView,这样当单击它时,它会弹出,并允许用户在其中滚动和交互,而不需要与任何其他ListView相同 对XML使用以下内容: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <ListView android:id="@+id/menuGroupsLis

我想在“选项”菜单中添加一个ListView,这样当单击它时,它会弹出,并允许用户在其中滚动和交互,而不需要与任何其他ListView相同

对XML使用以下内容:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
        <ListView android:id="@+id/menuGroupsList" android:layout_width="fill_parent"
            android:layout_height="fill_parent"/>
</menu>
从findViewById返回null

这有可能吗


谢谢,不要使用菜单栏。相反,创建一个包含列表的自定义布局。
覆盖OnPrepareOptions功能表(…)并创建一个对话框,您可以使用自定义布局对其进行充气

Dialog dlg = new Dialog(context);
dlg.setContentView(R.layout.splashscreen);
dlg.show();

我很有信心这是不可能的。选项菜单真的是你需要的吗?或者你指的是上下文菜单?我很难想象一个包含列表视图的选项菜单会是什么样子。@Maggie well我试图实现的是一个弹出列表视图,但是当点击android上的设置按钮时,它会弹出。
Dialog dlg = new Dialog(context);
dlg.setContentView(R.layout.splashscreen);
dlg.show();