android 怎么给我写的程序添加一个图标并且在menu里面显示  不知道怎么把我写的程序 添加到menu里面。
如何在menu里面创建一个图标。

解决方案 »

  1.   

    menu.add(0,3,4,R.string.test).setIcon(R.drawable.icon)
      

  2.   

    我一直不太明白add里面的参数问题,这个东西有参考手册还是android官网上有?android的开发者网站是不是被墙了?
      

  3.   


    add (int groupId, int itemId, int order, CharSequence title) 
    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. //组ID号,即menu可以多个分为一组,则该ID号一样
    itemId:Unique item ID. Use NONE if you do not need a unique ID.//这个ItemId,即每个Item的ID号,就像xml中的button的id号一样,唯一识别 
    order:The order for the item. Use NONE if you do not care about the order. See getOrder(). //这个是显示在menu菜单中的顺序号
    title:The text to display for the item.//这个肯定是title啦!android-sdk下的帮助文档里面有!
    楼主可以去看看!
      

  4.   

    menu.add(0,3,4,R.string.test).setIcon(R.drawable.icon)