porthfind
porthfind

Reputation: 1619

Android: Icon doesn't appear in ActionBar

I'm programming an android application and since the first moment the icon doesn't appear on the Action Bar. I've already read/applied lots of possible solutions but it doesn't appear. Can you please help me?

Manifest.xml:

(...)
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
(...)

styles.xml:

(...)
   <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="android:icon">@drawable/ic_launcher</item>
    </style>

and I'm using the following configuration:

defaultConfig {
    applicationId "com.converter.android.converter"
    minSdkVersion 11
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
}

Upvotes: 0

Views: 150

Answers (2)

anurag_dake
anurag_dake

Reputation: 1148

If you are using AppCompat theme in your application, then the app icon won't be visible on Action bar.

As you can see the Google's apps with material design, there isn't any app icon on ActionBar.

But if you want to add app icon, try using toolbar and hide actionbar.

Upvotes: 1

CommonsWare
CommonsWare

Reputation: 1006744

Also tried ActionBar actionBar = getActionBar(); actionBar.setIcon(R.drawable.ic_launcher) But this is only possible to API 14

If you are using appcompat-v7, as your theme suggests, you call getSupportActionBar() on your ActionBarActivity, not getActionBar().

Upvotes: 0

Related Questions