开发者

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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜