Reputation: 2535
My main file:
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:showAsAction="never"
android:title="@string/action_settings">
<menu>
<item
android:id="@+id/menu_adhoc1"
android:icon="@drawable/icon_custom"
android:title="@string/menuitem2_3"/>
<item
android:id="@+id/cPanel1"
android:icon="@drawable/icon_cpanel"
android:title="@string/menuitem2_5"/>
<item
android:id="@+id/tutorial1"
android:icon="@drawable/icon_tutorial"
android:title="@string/menuitem2_4"/>
</menu>
</item>
</menu>
What I am trying to achieve is that place three more options under the menu, however I get only one option under menu labelled as "Settings", clicking on this leads to the desired result of getting three options under the menu. Where am I going wrong, any hints?
Upvotes: 0
Views: 272
Reputation: 67189
The problem is that you nested a <menu>
containing <item>
s inside another <item>
.
As per the Menu documentation, this adds your second menu as a submenu of the parent item.
What it sounds like you are looking for is all the items being withing the same menu, like so:
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:showAsAction="never"
android:title="@string/action_settings" />
<item
android:id="@+id/menu_adhoc1"
android:icon="@drawable/icon_custom"
android:title="@string/menuitem2_3"/>
<item
android:id="@+id/cPanel1"
android:icon="@drawable/icon_cpanel"
android:title="@string/menuitem2_5"/>
<item
android:id="@+id/tutorial1"
android:icon="@drawable/icon_tutorial"
android:title="@string/menuitem2_4"/>
</menu>
Upvotes: 1