更新sdk到21版本后logo不显示。我使用以下代码显示 Logo :
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setIcon(R.drawable.ic_launcher);
代码如下: http://i.stack.imgur.com/fAWIx.png
这段代码:
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setIcon(R.drawable.ic_launcher);
外观: http://i.stack.imgur.com/hkYqa.png
这段代码:
actionBar.setDisplayHomeAsUpEnabled(true);
外观: http://i.stack.imgur.com/Ssw2A.png
我的 Logo 没有显示为后退按钮。
如何像这里一样制作旧样式? http://i.stack.imgur.com/BKOz4.png
注意:抱歉,我没有注意到类似的问题。 =(
最佳答案
- 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/