Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Option Menu Not Displaying Text

Tags:

android

I created my menu with this code:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:id="@+id/donate" 
        android:icon="@drawable/donate" 
        android:title="Donate"/>

    <item android:title="@string/color_picker" 
        android:id="@+id/color_picker" 
        android:icon="@drawable/colorpicker"/>
</menu>

When I hit the menu button the images appear but the text does not. I'm trying to get the text to show and as far as I can tell the text should appear... Am I doing something wrong?

like image 460
sipjca Avatar asked Feb 03 '23 19:02

sipjca


1 Answers

In case you haven't figured it out yet, I think that your icons are not the right size. I had the same problem and fixed it with appropriate icon sizes. Check out this article: http://developer.android.com/guide/practices/ui_guidelines/icon_design.html#icon-sets

Basically you have to create 3 sets of the same icons but with different sizes:

/res/drawable-hdpi with 72 by 72 pixel icons

/res/drawable-mdpi with 48 by 48 pixel icons

and

/res/drawable-ldpi with 36 by 36 pixel icons

So when your app is run on a HTC Wildfire for example, @drawable/donate will actually refer to /res/drawable-ldpi/donate.png but on a MyTouch3G it will refer to /res/drawable-mdpi/donate.png

like image 198
Mircea Nistor Avatar answered Feb 06 '23 16:02

Mircea Nistor