ActionBar does not display Icon

0

I'm using the Eclipse "Luna Service Release 2 (4.4.2)" to create my projects on Android. Whenever I create any project and run it, ActionBar does not display the icon that is defined in the AndroidManifest.xml file : android:icon="@drawable/ic_launcher"

What do I have to do to make the app icon show on ActionBar ?

    
asked by anonymous 16.04.2015 / 19:15

1 answer

1

You can do it in two ways:

By file styles.xml :

<style name="AppTheme" parent="Theme.AppCompat.Light">
    <item name="actionBarStyle">@style/MyActionBar</item>
</style>

<style name="MyActionBar" parent="@style/Widget.AppCompat.Light.ActionBar.Solid">
    <item name="logo">@drawable/ic_launcher</item>
    <item name="displayOptions">useLogo|showHome</item>
</style>

Or directly in Activity :

getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setIcon(R.drawable.ic_launcher);
    
17.04.2015 / 14:21