与AppCompat-V7 21的动作条/工具栏显示图标 [英] show icon in actionbar/toolbar with AppCompat-v7 21

查看:156
本文介绍了与AppCompat-V7 21的动作条/工具栏显示图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了这些 - 但仍然没有看到这样的图标之前:

I tried these - but still do not see the icon like before:

getSupportActionBar().setLogo(R.drawable.ic_launcher);
getSupportActionBar().setDisplayUseLogoEnabled(true);
getSupportActionBar().setIcon(R.drawable.ic_launcher);

看来,当我使用自定义工具栏的工作 - 但是,这将迫使我摸所有布局 - 有没有更好的方式来做到这一点。

It seems to work when I use custom toolbar - but that would force me to touch all layouts - is there a better way to do so?

推荐答案

getSupportActionBar()setDisplayShowHomeEnabled(真);

以及

getSupportActionBar()的setIcon(R.drawable.ic_launcher);

这篇关于与AppCompat-V7 21的动作条/工具栏显示图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆