The Application Icon Does Not Show on Action Bar

The application icon does not show on action bar

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);

Application's icon not displayed in ActionBar

Your activity must extend ActionBarActivity.

For example:

public class MainActivity extends ActionBarActivity
{
...
}

Or try this in your activity:

ActionBar actionBar = getActionBar();
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE);
actionBar.setIcon(R.drawable.ic_launcher);

You will have to use getSupportActionBar() if using the support library.

Action Bar icon not showing in android action bar

update your acbar.xml as the following:

EDIT:Code

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"

xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/home1"
android:orderInCategory="0"
android:icon="@drawable/home_icon"
android:title="Navigate to Home"

app:showAsAction="always"/>

</menu>

No App Icon on ActionBar

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.

No application icon in Action Bar

If you're using the appcompat-v7 support library for support with Android 5.0, there would not be an action bar logo because of the new design concept.



Related Topics



Leave a reply



Submit