Android 3.0: Create a custom menu with submenu
I am working with Android 3.0.
I am trying to build a custom menu in the action bar that has sub-menus in it. Anybody has the 开发者_运维知识库XML hierarchy that should be written?
<item>
elements can contain <menu>
elements. I've only tested this on ICS but it looks like it should work on Honeycomb as well.
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/menu_dropdown"
android:title="More"
android:showAsAction="always">
<menu>
<item android:id="@+id/menu_one" android:title="One" />
<item android:id="@+id/menu_two" android:title="Two" />
</menu>
</item>
</menu>
精彩评论