tags:

views:

25

answers:

1

Hi Everyone,

I have an android app and I want to set an icon. I have set the icon using androidmanifest.xml and that shows the icon inside the app list. However, I want the icon to be displayed while the application is running, also. Any help/hints ?

Thanks.

- ahsan

+1  A: 

There's nothing built-in to do this. Just make an ImageView in one of your view layouts and point it at the icon resource. Style and adjust to your tastes.

<ImageView android:src="@drawable/icon"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content" />

If you want your image to be part of the grey title bar that appears by default in activities, I don't think you can do that - but you can easily turn off this title bar and just make your own. To turn off the title bar, just set the theme for the activity in the AndroidManifest.xml file.

android:theme="@android:style/Theme.NoTitleBar"
Nick
thanks for the help, but theres a catch... I want the icon to appear to the left of the application name (just like a favicon !)...Is there a way to do that ? please let me know. Thanks. :)
Ahsan
See updated answer - don't think you can insert an image into the existing title, but you can certainly replace it with your own title bar.
Nick
oh..thanks a lot Nick :)
Ahsan