该应用程序图标不会在动作条上显示 [英] The application icon does not show on action bar

查看:136
本文介绍了该应用程序图标不会在动作条上显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我跟进建设一个新的Andr​​oid项目的指示,我得到了一个可运行的人,除了用行动酒吧的一个问题。问题是,应用程序图标没有在操作栏上的应用程序标题旁边显示。我创建了下面的配置项目:

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:

  • 最低要求SDK:API 8:Android 2.2的(升级Froyo)

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

目标SDK:API 21:安卓4.X(L preVIEW)

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

编译:API 21:安卓4.X(L preVIEW)

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

主题:全息光与暗操作栏(Eclipse中设置相应的appcompat主题)

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

Android的支持库21.0.1

Android Support Library 21.0.1

Android SDK中内建工具21.1.1

Android SDK Build-tools 21.1.1

由于我最小的SDK API 8不支持行动起来吧,所以该项目包括一个 appcompat_v7库允许操作栏功能。如果我设置最小的SDK API 14(安卓4.0)或更高,那么这个项目不包括 appcompat_v7库键,应用程序图标是显示成功也。但我需要我的应用程序支持老的Andr​​oid OS低至API 8.所以,我应该怎么做才能解决这个问题?真的AP preciate你们的关注。

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.

PS:我通过任务去上面在Windows,Mac,日食,机器人工作室,得到了相同的结果。

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

推荐答案

正在使用 AppCompat 版本21+,这是正常的。

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:

使用应用程序图标加上标题作为一个标准的布局是   鼓励对API 21的设备和新的。

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

如果您希望应用程序图标(但我反对这样做),你可以使用的方法 setLogo()

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

事情是这样的:

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

这篇关于该应用程序图标不会在动作条上显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆