开发者

android dev: how to implement for add method in menu interface?

开发者 https://www.devze.com 2022-12-31 18:41 出处:网络
who knows about the method \"add\" in menu interface? how to implement exactly? which is it\'s imlementation class? i couldn\'t find detail implementation in sou开发者_Python百科rce code of sdk. i wan

who knows about the method "add" in menu interface? how to implement exactly? which is it's imlementation class? i couldn't find detail implementation in sou开发者_Python百科rce code of sdk. i want to check how to implement in android source code for "add" method.

e.g.

public boolean onCreateOptionsMenu(Menu menu) {
    menu.***add***(0, MENU_NEW_GAME, 0, "New Game");
    menu.add(0, MENU_QUIT, 0, "Quit");
    return true;
}

thanks in advance!


public abstract MenuItem add (int groupId, int itemId, int order, CharSequence title) Since: API Level 1 Add a new item to the menu. This item displays the given title for its label.

Parameters::

groupId The group identifier that this item should be part of. This can be used to define groups of items for batch state changes. Normally use NONE if an item should not be in a group.

itemId Unique item ID. Use NONE if you do not need a unique ID.

order The order for the item. Use NONE if you do not care about the order. See getOrder().

title The text to display for the item.

Returns The newly added menu item.

0

上一篇:

:下一篇

精彩评论

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