其他分享
首页 > 其他分享> > android – appcompat 21徽标作为后退按钮

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

作者:互联网

更新后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,android-actionbar,appcompat
来源: https://codeday.me/bug/20190728/1560813.html