Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The application icon does not show on action bar

I followed up the instructions of building a new android project and I got a runnable one except a problem with action bar. The problem is that the application icon is not showed beside the application title on action bar. I created the project with the configuration below:

  • Minimum required SDK:API 8: Android 2.2(Froyo)

  • Target SDK:API 21:Android 4.X(L preview)

  • Compile With:API 21:Android 4.X(L preview)

  • Theme:Holo Light with Dark Action Bar(Eclipse set the corresponding appcompat theme)

  • Android Support Library 21.0.1

  • Android SDK Build-tools 21.1.1

Because my minimum sdk is api 8 which does not support action bar, so the project includes a appcompat_v7 library to allow the action bar feature. If I set the minimum sdk to api 14(android 4.0) or higher, then the project does not include appcompat_v7 library and application icon is showed successfully also. But I need my app to support older android os as low as api 8. So what should I do to fix this problem? Really appreciate you guys attention.

P.S: I went through the task above on windows ,mac, eclipse , android studio and got the same result.

like image 646
jeep Avatar asked Nov 10 '14 07:11

jeep


People also ask

How to fix app icons not showing in taskbar Windows 10?

7 Best Ways to Fix App Icons Not Show­ing in Taskbar on Win­dows 10. 1 1. Restart Windows Explorer. Before you do that, you should note that it will close all open windows and maybe even apps. You can save all your work ... 2 2. Disk Cleanup Tool. 3 3. Display Driver. 4 4. Rebuild Icon Cache. 5 5. Registry Editor. More items

How to check if Action Center is turned off?

I would suggest you to try the steps below to check if action center is disabled: 1 Press windows key + I 2. Click on "system" 3. Click on "notifications and actions" on the left pane. 4. Click on "turn system icons on or off"

What are the functions of the icons on the taskbar?

Besides, it is through the icons displayed on the taskbar that you can immediately come back to the desktop, alter the system volume magnitude, open the Windows Explorer, check the time and date, and many more with no end to the list of reliable tools it serves.

How to turn on Action Center in Windows 10?

1 Press windows key + I 2. Click on "system" 3. Click on "notifications and actions" on the left pane. 4. Click on "turn system icons on or off" 5. If action center is disabled, turn it on.


2 Answers

You are using the AppCompat version 21+ and it is normal.

The Action Bar follows the material design guidelines and uses a Toolbar. As you can read here:

The use of application icon plus title as a standard layout is discouraged on API 21 devices and newer.

If you would like an application icon (but I discourage it), you can use the method setLogo().

Something like this:

ActionBar actionBar = getSupportActionBar(); actionBar.setLogo(R.drawable.my_logo); actionBar.setDisplayUseLogoEnabled(true); actionBar.setDisplayShowHomeEnabled(true); 
like image 55
Gabriele Mariotti Avatar answered Oct 02 '22 17:10

Gabriele Mariotti


This issue comes when you use support library revised 21.

Use:

ActionBar actionBar = getSupportActionBar(); actionBar.setLogo(R.drawable.ic_launcher); actionBar.setDisplayUseLogoEnabled(true); actionBar.setDisplayShowHomeEnabled(true); 

It worked for me or you can use toolbar. A Toolbar is a generalization of action bars for use within application layouts.

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.

Reference: https://developer.android.com/reference/android/support/v7/widget/Toolbar.html

like image 23
Ishan Avatar answered Oct 02 '22 17:10

Ishan