Eli Revah
Eli Revah

Reputation: 3676

Menu icons won't appear

I'm trying to add some menu items with icons to a menu. The items appear but without the icon on the left side of them, it's just the text...

By the way, I'm using the Holo Light theme...

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
    <item 
        android:id="@+id/menu_market" 
        android:title="View on Play Store"
        android:icon="@drawable/ic_playstore_colorful"/>
</menu>

Thanx upfront!

Upvotes: 1

Views: 331

Answers (1)

Okay so i found this android blog post, http://android-developers.blogspot.com/2012/01/say-goodbye-to-menu-button.html and they mentioned how the whole menu paradigm is changing in ICS and they said to use the actionbar now, requires API 11 or later:

I have this in /res/menu/activity_main XML directory:

<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/firstmenu"
        android:title="@string/menu_settings" 
        android:icon="@drawable/ic_launcher"
        android:showAsAction="always|withText">
        <menu>
            <item android:id="@+id/submenu"
                android:title="SubMenu">                
                </item>


                </menu>
        </item>
        <item android:id="@+id/secondmenu"
            android:title="seconditem"
            android:icon="@drawable/ic_launcher"
            android:showAsAction="always|withText">

        </item>
</menu>

And this in source of course:

@Override
public boolean onCreateOptionsMenu(Menu menu)
{

    super.onCreateOptionsMenu(menu);
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.activity_main, menu);
        return true;
}

Works pretty well and looks good.

Upvotes: 1

Related Questions