android – appcompat 21徽标作为后退按钮

android – appcompat 21徽标作为后退按钮,第1张

概述更新后sdk到21版本徽标不显示.我使用以下代码显示徽标: actionBar.setDisplayShowHomeEnabled(true);actionBar.setDisplayHomeAsUpEnabled(true);actionBar.setIcon(R.drawable.ic_launcher); 代码看起来: http://i.stack.imgur.com/fAWIx.png 更新后sdk到21版本徽标不显示.我使用以下代码显示徽标:

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

我的徽标不显示为后退按钮.

我怎么在这里做旧风格? 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徽标作为后退按钮全部内容,希望文章能够帮你解决android – appcompat 21徽标作为后退按钮所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1122281.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存