【发布时间】:2011-05-19 05:34:41
【问题描述】:
许多菜单总是有一个相同的项目。
有没有办法将该项目定义为额外菜单并将其包含在所有其他菜单中?
类似这样的:
菜单/main.xml
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/menu_main"
android:title="@string/text_mainmenu" />
</menu>
菜单/other.xml
<menu xmlns:android="http://schemas.android.com/apk/res/android"
parent="@menu/main">
<item android:id="@+id/menu_other"
android:title="@string/text_othermenu" />
</menu>
我知道,可以通过编程方式进行,但我认为 xml-way 更好。
【问题讨论】: