Question

I try using Icons on several places in my app with the following code

    android:icon="@drawable/app_logo" />

but neither do they do show up nor do I get an error/warning. I put app_logo.png into the res/drawable folder, then into any other drawable folder (res/drawable-hdpi, res/drawable-ldpi...) but the app_logo won't show up in my app. Can somebody please help me trace down the error?

edit: I want to use them in a menu and in a tab view, taken from online examples like

<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/icon"
    android:icon="@drawable/help_logo" />
<item android:id="@+id/help"
    android:title="Help Text" />
<item android:id="@+id/icontext"
    android:title="App Logo Text"
    android:icon="@drawable/app_logo" />

Was it helpful?

Solution

You cannot use android:icon in "several places". Or, technically, you can, however it would only make sense to use this within elements that supports android:icon attribute, otherwise it will just be skipped.

EDIT

android:icon for menus will appear for 6 menu items on Android 2.x (or 5 if you got more than 6 as 6th position is taken by system in such case, to let you expand menu more) and earlier, once user hit menu button. It will not appear if your menu got more items. It will also not appear if your device is running Android 3.0 and up. I'd recommend abandoning menus and switch to action bar pattern

OTHER TIPS

I finally found what's the problem thanks to android Tab icons dont show up

My app still had the title bar - adding

    android:theme="@android:style/Theme.NoTitleBar" 

to the manifest solved everything. Would be curious though how it would be possible to keep both the TitleBar and the icons.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top