许多菜单总是有一个项目相同.
有没有办法将该项目定义为额外菜单并将其包含在所有其他菜单中?
像这样的东西:
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/menu_main"
android:title="@string/text_mainmenu" />
</menu>
Run Code Online (Sandbox Code Playgroud)
<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>
Run Code Online (Sandbox Code Playgroud)
我知道,有可能以programmaticaly方式进行,但我认为xml-way更好.