使用AppCompat

编程入门 行业动态 更新时间:2024-10-22 12:23:15
使用AppCompat-v7在actionbar /工具栏中显示图标21(show icon in actionbar/toolbar with AppCompat-v7 21)

我试过这些 - 但仍然看不到像以前的图标:

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

当我使用自定义工具栏时,它似乎工作 - 但这将迫使我触摸所有布局 - 有更好的方法吗?

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(true);

随着

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

getSupportActionBar().setDisplayShowHomeEnabled(true);

along with

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

更多推荐

本文发布于:2023-08-01 04:05:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1352841.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:AppCompat

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!