开发者

android how to put list of items for an submenu item

开发者 https://www.devze.com 2023-03-28 22:33 出处:网络
I want to add a no of items to an existing submenu with this xml: <item android:id=\"@+id/chooseCountry\" android:title=\"Choose Country\">

I want to add a no of items to an existing submenu with this xml:

<item android:id="@+id/chooseCountry" android:title="Choose Country">
    <menu>
        <item android:id="@+id/india" android:title="India" >
            <menu>
                <item android:id="@+id/blor" android:title="Bangalore" />
                <item androi开发者_开发技巧d:id="@+id/delhi" android:title="Delhi" />
                <item android:id="@+id/hyd" android:title="Hyderabad" />
            </menu>
        </item>
        <item android:id="@+id/pak" android:title="Pakistan" />
        <item android:id="@+id/africa" android:title="South Africa" />
    </menu>
</item>

I am getting but this exception:

08-15 12:57:50.942: ERROR/AndroidRuntime(312): java.lang.UnsupportedOperationException: Attempt to add a sub-menu to a sub-menu.

How can i add items to a submenu item?

Thank you

0

精彩评论

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