从 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).