隐藏的抽屉式导航栏主页按钮的应用程序图标 [英] Hide app icon on navigation drawer home button

查看:487
本文介绍了隐藏的抽屉式导航栏主页按钮的应用程序图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Nexus 5(无实体按键),这是正常的,我的操作栏是如下:

In my Nexus 5 (without physical buttons) it's alright, my action bar is as follow:

这就是我想要的所有设备。

相反,与物理按键的设备,出现这种情况:

Instead, in devices with physical buttons, this happens:

我应该怎么做来强制始终显示主页按钮没有应用程序图标

What should I do to force to show always the home button without the app icon?

用于设置动作条在我的活动(在OnCreate()方法)的code是:

The code used to setup the ActionBar in my Activity (in the onCreate() method) is:

private void setupActionBar() {
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
    actionBar.setCustomView(R.layout.action_bar_layout);
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setDisplayHomeAsUpEnabled(false);
    actionBar.setDisplayUseLogoEnabled(false);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayShowCustomEnabled(true);
}

如果我更改:

actionBar.setDisplayShowHomeEnabled(false);

actionBar.setDisplayShowHomeEnabled(true);

然后我得到了所有设备(无论有或没有物理按键):

then I obtain that in all devices (both with or without physical buttons):

但我不希望有3条线路附近的图标的应用程序图标!

but I don't want the app icon near the icon with 3 lines!

推荐答案

设置自定义样式动作条是这样的:

Set custom style for ActionBar like this:

<style name="ActionBar" parent="android:Widget.Holo.ActionBar">
    ...
    <item name="android:icon">@android:color/transparent</item> <!-- Hide logo from the action bar -->
</style>

薄设置方式如下这种风格应用主题:

thin set this style in application theme following way:

<item name="android:actionBarStyle">@style/ActionBar</item>

其中:

<color name="transparent">#00000000</color>

祝你好运!

这篇关于隐藏的抽屉式导航栏主页按钮的应用程序图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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