从 android 上的操作栏中删除图标/徽标 [英] Remove icon/logo from action bar on android

查看:27
本文介绍了从 android 上的操作栏中删除图标/徽标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试寻找从操作栏中删除图标/徽标的方法,但经过一个小时的搜索 SO、Android 文档和 Google 后,我发现的唯一方法是如何完全删除标题栏.那不是我想要的.只想从标题栏中删除图标/徽标.

I've been trying to find some way of removing the icon/logo from the action bar but the only thing I've found after an hour of searching SO, Android's documentation and Google is how to remove the title bar in whole. That is not what I want. Only want to remove the icon/logo from the title bar.

有人知道如何做到这一点吗?我最好在 XML 中执行此操作.

Any one know how to accomplish this? Preferably I'd like to do this in XML.

推荐答案

如果你已经在 中定义了 android:logo="..."> 你的AndroidManifest.xml 标签,那么你需要用这个东西来隐藏图标:

If you've defined android:logo="..." in the <application> tag of your AndroidManifest.xml, then you need to use this stuff to hide the icon:

<item name="logo">@android:color/transparent</item>

v11 及更高版本主题

<item name="android:logo">@android:color/transparent</item>

这两种样式的使用为我正确隐藏了 2.3 和 4.4 设备上的操作栏图标(此应用使用 AppCompat).

The use of these two styles has properly hidden the action bar icon on a 2.3 and a 4.4 device for me (this app uses AppCompat).

这篇关于从 android 上的操作栏中删除图标/徽标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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