没有应用程序图标上的动作条 [英] No App Icon on ActionBar

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

问题描述

有很多疑问的在这里对添加图标动作条,但没有解决我的问题。如果你知道这个问题重复,随意评论或关闭这个问题。

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.

我迁移我的项目的IntelliJ,我没有遇到这样的问题,我的previous IDE(Eclipse中)。

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

问题:应用程序图标没有在动作条显示

我觉得它应该在默认情况下,这就是为什么我不能通过其XML添加添加

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

下面是它的XML

<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context=".MainActivity" >

    <item android:id="@+id/action_settings"
        android:title="@string/action_settings"
        android:orderInCategory="100"
        app:showAsAction="always" />
</menu>

谢谢!

推荐答案

由于AppCompat版本21,操作栏遵循的材料设计方针并使用<一个href="https://developer.android.com/reference/android/support/v7/widget/Toolbar.html">Toolbar:

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

      
  • 一个标题和副标题。的标题应该是一个路标导航层次结构中的工具栏的当前位置和包含的内容在那里。字幕,如果present应注明有关当前内容的扩展信息。 如果一个应用程序使用的标志形象,应该认真考虑省略了标题和副标题。
  •   
  • 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.

在现代的Andr​​oid UI的开发者应该靠更上工具栏比他们的应用程序图标视觉上不同的色彩方案。 使用应用程序图标加上标题为标准布局不鼓励对API 21的设备和新的。

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.

不过,如果你想要一个应用程序图标,<一个href="https://developer.android.com/reference/android/support/v7/widget/Toolbar.html#setLogo(int)">setLogo()是正确的方法。

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

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

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