shayan pourvatan shayan pourvatan - 1 month ago 21
Android Question

icon in menu not showing in android

i want to add menu handler to my project, i read http://developer.android.com/guide/topics/ui/menus.html too,its very simple but icon not shown to me, i very confused. even i add menu item programmatically.
my code is:

@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.add(0, 0, 0, "Quit").setIcon(R.drawable.ic_launcher);
getMenuInflater().inflate(R.layout.menu, menu);
return true;
}


and in xml:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Single menu item
Set id, icon and Title for each menu item
-->
<item android:id="@+id/menu_bookmark"
android:icon="@drawable/update"
android:title="@string/Update" />

</menu>

Answer

If you're running your code on Android 3.0+, the icons in the menu are not shown by design. This is a design decision by Google.

You can read more about it in this on Android developers blog.