简体   繁体   English

单击项目上的溢出菜单可弹出菜单

[英]Overflow Menu on item click for Popup Menu

I am working on android project and I am wanting to do so something but I can't find how to do it. 我正在从事android项目,但我想这样做,但是我找不到方法。 I've called it an Overflow Menu but I am not sure if that's the correct name. 我称它为“溢出菜单”,但我不确定这是否正确。

Basically, what I am trying to do, when the user clicks certain GUI element a popup menu is shown, when the user selects a certain menu item, an extra menu is shown with some more menu items. 基本上,我正在尝试做的是,当用户单击某些GUI元素时,将显示一个弹出菜单,当用户选择某个菜单项时,将显示带有更多菜单项的额外菜单。

There should be some sort of indication to show that there is a some more menu items for a particular menu item. 应该有某种指示来表明特定菜单项还有更多菜单项。

Below is the XML that I have tried to define the menu but it only shows the second menu item not the host menu item. 下面是我尝试定义菜单的XML,但是它仅显示第二个菜单项,而不显示主机菜单项。

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:id="@+id/dbTable_mnu"
        android:title="Select Rows">
        <item android:id="@+id/test"
            android:title="Test">
        </item>
    </item>
</menu>

Thanks for any help you can provide. 感谢您的任何帮助,您可以提供。

Nested submenus are defined using the <menu> tag inside an <item> block. 嵌套子菜单是使用<item>块内的<menu>标记定义的。

<menu xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:id="@+id/dbTable_mnu" android:title="Select Rows">
        <menu>
            <item android:id="@+id/test" android:title="Test" />
        </menu>
    </item>
</menu>

See Menu Resource on the Android Developers site for more information. 有关更多信息,请参见Android Developers网站上的菜单资源

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM