Alex F
Alex F

Reputation: 43311

setIcon(ic_menu_more) doesn't have effect

Sample code from the book:

@Override
public boolean onCreateOptionsMenu(Menu menu) 
{
    super.onCreateOptionsMenu(menu);

    MenuItem menuItem = menu.add(0, Menu.FIRST, 0, "Go");

    menuItem.setIcon(android.R.drawable.ic_menu_more);    // doesn't work

    return true;
}

When I press Menu button in Android emulator, "Go" option is shown in the bottom of the screen, but without any icon - both if setIcon called or not. What is wrong?

Upvotes: 2

Views: 3432

Answers (1)

Houcine
Houcine

Reputation: 24181

refer this tuto . hope it helps

EDIT : try this :

@Override
    public boolean onCreateOptionsMenu(Menu menu) {
        SubMenu m = menu.addSubMenu(0, 1000, 0, "Go");
        m.setIcon(android.R.drawable.ic_menu_add);
        return super.onCreateOptionsMenu(menu);
    }

Upvotes: 1

Related Questions