I have made submenu with some items in it. Now I want to add different icon with submenu items. I have also applied the code to the menu items for adding icon but it is not showing me icons my code is this:
public boolean onCreateOptionsMEnu(Menu m) {
SubMenu s1 = m.addSubMenu("menu1");
s1.add(0,0,1,"1").setIcon(R.drawable.icon1);
s1.add(0,1,2,"2").setIcon(R.drawable.icon2);
return super.onCreateOptionsMenu(m);
}
Submenus don't support icons.
https://developer.android.com/guide/topics/ui/menus.html:
Icon Menu
This is the collection of items initially visible at the bottom of the screen at the press of the MENU key. It supports a maximum of six menu items. THESE ARE the only menu items that support icons and the only menu items that do not support checkboxes or radio buttons.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With