gpt4 book ai didi

android - appcompat 21 标志作为后退按钮

转载 作者:太空宇宙 更新时间:2023-11-03 12:18:13 26 4
gpt4 key购买 nike

更新sdk到21版本后logo不显示。我使用以下代码显示 Logo :

actionBar.setDisplayShowHomeEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setIcon(R.drawable.ic_launcher);

代码如下: http://i.stack.imgur.com/fAWIx.png

enter image description here

这段代码:

actionBar.setDisplayShowHomeEnabled(true);
actionBar.setIcon(R.drawable.ic_launcher);

外观: http://i.stack.imgur.com/hkYqa.png

enter image description here

这段代码:

actionBar.setDisplayHomeAsUpEnabled(true);

外观: http://i.stack.imgur.com/Ssw2A.png

enter image description here

我的 Logo 没有显示为后退按钮。

如何像这里一样制作旧样式? http://i.stack.imgur.com/BKOz4.png

注意:抱歉,我没有注意到类似的问题。 =(

最佳答案

根据 Toolbar documentation :

  • 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.

但是,如果您想要一个应用程序图标,setLogo()确实是正确的方法。

关于android - appcompat 21 标志作为后退按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26642378/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com