开发者

Android 3.0: Create a custom menu with submenu

开发者 https://www.devze.com 2023-03-02 02:57 出处:网络
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.

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

精彩评论

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