简体   繁体   English

应用程序图标未显示在标题栏中

[英]App icon not showing in title bar

The App icon, definted in the manifest isn't showing in the latest 5.0.1. 清单中定义的应用程序图标未显示在最新的5.0.1中。 It looks just fine in the lesser software updates: 它在较小的软件更新中看起来很好:

 <application
        android:allowBackup="true"
        android:icon="@drawable/airoperf"
        android:label="@string/app_name"
       >

Any ideas why this isn't working anymore? 任何想法为什么这不再工作?

It is working just fine. 它工作得很好。 It is simply off by default, per Material Design. 根据Material Design,默认情况下它是关闭的。

Use getActionBar().setDisplayShowHomeEnabled(true); 使用getActionBar().setDisplayShowHomeEnabled(true); (native action bar) or getSupportActionBar().setDisplayShowHomeEnabled(true); (本机操作栏)或getSupportActionBar().setDisplayShowHomeEnabled(true); ( appcompat-v7 action bar) to enable it. appcompat-v7操作栏)启用它。

Here's another way - 这是另一种方式 -

getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setLogo(R.mipmap.ic_launcher);
getSupportActionBar().setDisplayUseLogoEnabled(true);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM