rsano rsano - 6 months ago 46
Android Question

No App Icon on ActionBar

There are a lot of queries here about adding icons to ActionBar but none solved my problem. If you know a duplicate of this question, feel free to comment or close this question.

I migrated my project to IntelliJ and I didn't encounter this problem with my previous IDE (Eclipse).

PROBLEM: The app icon is not displayed in the ActionBar.

enter image description here

I think it's supposed to be added by default that's why I can't add it through its XML

enter image description here

Here's its XML

<menu xmlns:android=""
tools:context=".MainActivity" >

<item android:id="@+id/action_settings"
app:showAsAction="always" />



As of AppCompat version 21, the Action Bar follows the material design guidelines and uses a Toolbar:

  • A title and subtitle. The title should be a signpost for the Toolbar's current position in the navigation hierarchy and the content contained there. The subtitle, if present should indicate any extended information about the current content. If an app uses a logo image it should strongly consider omitting a title and subtitle.

In modern Android UIs developers should lean more on a visually distinct color scheme for toolbars than on their application icon. The use of application icon plus title as a standard layout is discouraged on API 21 devices and newer.

However, if you want an application icon, setLogo() is the correct method.