Navigation drawer forces app name and icon to appear shortly on startup

雨燕双飞 提交于 2019-12-02 23:17:19

问题


Each time I start the app, the application name and icon appears very shortly on the left side over the drawer icon. This ruins the look of the custom ActionBar style.

How can I remove it? I already tried the top solution from StackOverflow, but they all refer to completely hiding the ActionBar. I don't want to hide it as I need it. I just don't know where to turn off this irritating display.

Note: I've let the Android Studio create the Navigation Drawer project for me so all the code came from the default creation.

EDIT

This is the code which appears in 3 locations: restoreActionBar, setUp and showGlobalContextActionBar. I am talking about the default Android Studio drawer project.

public void restoreActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayHomeAsUpEnabled(false);

// actionBar.setTitle(mTitle); }


回答1:


Best method is to set the display options to useLogo in your theme. E.g.

<style name="AppTheme" parent="android:Theme.Holo.Light">
    <item name="android:actionBarStyle">@style/AppTheme.ActionBar</item>
</style>

<style name="AppTheme.ActionBar" parent="android:Widget.Holo.Light.ActionBar.Solid">
    <item name="android:displayOptions">useLogo</item>
</style>

This won't actually show the logo (if set) because showHome is not included.




回答2:


Try to use these

actionBar.setDisplayHomeAsUpEnabled(false); actionBar.setDisplayShowTitleEnabled(false);



来源:https://stackoverflow.com/questions/25972220/navigation-drawer-forces-app-name-and-icon-to-appear-shortly-on-startup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!