How to include a common menu item in multiple menus in Android menu xml? -


many of menus have 1 item same all.

is there way define item menu , include other?

something this:

menu/main.xml

<menu xmlns:android="http://schemas.android.com/apk/res/android">     <item android:id="@+id/menu_main"           android:title="@string/text_mainmenu" /> </menu> 

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> 

i know, it's possible programmaticaly, thought xml-way nicer.

afaik, <include> works layout xml, not menu xml, though can give try. lacking that, programmatic option (inflating both menu xml files) option aware of.


Comments