开发者

Customized the icons of Menu items

开发者 https://www.devze.com 2023-03-30 17:43 出处:网络
Hi, I would like to know how can I customized Menu icons. For instance, if the menu option is \"Sa开发者_StackOverflow社区ve\" I want to put custom image rather than default image.

Hi, I would like to know how can I customized Menu icons. For instance, if the menu option is "Sa开发者_StackOverflow社区ve" I want to put custom image rather than default image. Hope it is clear. Thanks


MenuItem item;
        item.setIcon(icon);            // icon is Drawable icon
        item.setIcon(resIcon);         // resIcon is int resIcon


You will want to use the setIcon() function of MenuItem. It can accept either a Resource ID or a Drawable.

0

精彩评论

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

关注公众号