Actionbar does not show Icon

Asked

Viewed 284 times

0

I’m using the Eclipse "Luna Service Release 2 (4.4.2)" to create my projects on Android. Whenever I create a project and run it, Actionbar does not show the icon that is set in the file Androidmanifest.xml: android:icon="@drawable/ic_launcher"

What I have to do to get the app icon shown in ActionBar?

  • What version of SDK? Are you using AppCompat? If possible, show your Styles.xml or xml themes..

  • Hello Paulo Rodrigues! My Styles.xml is the default: <Resources> <style name="Appbasetheme" Parent="Theme.AppCompat.Light"</style> <style name="Apptheme" Parent="Appbasetheme"> </style> </Resources>

1 answer

1


You can do it 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);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.