应用程序图标是不可见的动作条在Android的棒棒糖及以上棒棒糖、应用程序、图标、动作

2023-09-12 23:39:13 作者:我在有你的梦里哭到失控

我刚刚从API 19奇巧,以API 21棒棒堂迁移。现在我发现,应用程序图标是不存在的动作条。我觉得我的应用程序看起来有点不同。那么,有什么办法可以显示应用程序图标。感谢您的帮助:)

I just migrate from api 19 Kitkat to api 21 Lollipop. And now I have found that the app icon is not there on actionbar. I feel that my app looks kind of different. So is there any way to show the app icon. Thanks for any help :)

推荐答案

在材料的主题(和AppCompat版本21这是基于它),操作栏遵循的材料设计方针并使用Toolbar:

In the Material theme (and AppCompat version 21 which is based on it), 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.

不过,如果你想要一个应用程序图标,setLogo()是正确的方法。

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