如何在加载时隐藏样式xml主题中的动作栏

时间:2014-08-30 15:36:42

标签: java android xml android-actionbar

我有一个自定义主题,我为我的应用程序显示。但是,在我的主要活动类中,我为操作栏字体设置了自定义字体。

// Make sure you find out why it appears after a whole 1 second after the app appears
SpannableString s = new SpannableString("GetDisciplined");
s.setSpan(new TypefaceSpan(this, "roboto-light.ttf"), 0, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

// Update the action bar title with the TypefaceSpan instance
ActionBar actionBar = getActionBar();
actionBar.setTitle(s);
// set the action bar in this activity as the home
actionBar.setHomeButtonEnabled(true); 

启动应用程序后,我想立即显示自定义字体。

我做了一些研究,大部分解决方案都没有用,但我现在尝试使用启动"闪屏"没有操作栏的应用程序主题,然后在我的主活动类中使用操作设置custom_theme。

有点像这样。

https://stackoverflow.com/a/12724687/3120659

但我不确定如何修改我当前的样式主题来做到这一点。

<?xml version="1.0" encoding="utf-8"?>


<resources>

    <style name="Theme.Light_appalled" parent="@style/Theme.AppCompat.Light.DarkActionBar">
        <item name="actionBarItemBackground">@drawable/selectable_background_light_appalled</item>
        <item name="popupMenuStyle">@style/PopupMenu.Light_appalled</item>
        <item name="dropDownListViewStyle">@style/DropDownListView.Light_appalled</item>
        <item name="actionBarTabStyle">@style/ActionBarTabStyle.Light_appalled</item>
        <item name="actionDropDownStyle">@style/DropDownNav.Light_appalled</item>
        <item name="actionBarStyle">@style/ActionBar.Solid.Light_appalled</item>
        <item name="actionModeBackground">@drawable/cab_background_top_light_appalled</item>
        <item name="actionModeSplitBackground">@drawable/cab_background_bottom_light_appalled</item>
        <item name="actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Light_appalled</item>



                <!-- Light.DarkActionBar specific -->
        <item name="actionBarWidgetTheme">@style/Theme.Light_appalled.Widget</item>

    </style>

    <style name="ActionBar.Solid.Light_appalled" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
        <item name="background">@drawable/ab_solid_light_appalled</item>
        <item name="backgroundStacked">@drawable/ab_stacked_solid_light_appalled</item>
        <item name="backgroundSplit">@drawable/ab_bottom_solid_light_appalled</item>
        <item name="progressBarStyle">@style/ProgressBar.Light_appalled</item>
    </style>

    <style name="ActionBar.Transparent.Light_appalled" parent="@style/Widget.AppCompat.ActionBar">
        <item name="background">@drawable/ab_transparent_light_appalled</item>
        <item name="progressBarStyle">@style/ProgressBar.Light_appalled</item>
    </style>

    <style name="PopupMenu.Light_appalled" parent="@style/Widget.AppCompat.PopupMenu">  
        <item name="android:popupBackground">@drawable/menu_dropdown_panel_light_appalled</item>
    </style>

    <style name="DropDownListView.Light_appalled" parent="@style/Widget.AppCompat.ListView.DropDown">
        <item name="android:listSelector">@drawable/selectable_background_light_appalled</item>
    </style>

    <style name="ActionBarTabStyle.Light_appalled" parent="@style/Widget.AppCompat.ActionBar.TabView">
        <item name="android:background">@drawable/tab_indicator_ab_light_appalled</item>
    </style>

    <style name="DropDownNav.Light_appalled" parent="@style/Widget.AppCompat.Spinner.DropDown.ActionBar">
        <item name="android:background">@drawable/spinner_background_ab_light_appalled</item>
        <item name="android:popupBackground">@drawable/menu_dropdown_panel_light_appalled</item>
        <item name="android:dropDownSelector">@drawable/selectable_background_light_appalled</item>
    </style>

    <style name="ProgressBar.Light_appalled" parent="@style/Widget.AppCompat.ProgressBar.Horizontal">
        <item name="android:progressDrawable">@drawable/progress_horizontal_light_appalled</item>
    </style>

    <style name="ActionButton.CloseMode.Light_appalled" parent="@style/Widget.AppCompat.ActionButton.CloseMode">
        <item name="android:background">@drawable/btn_cab_done_light_appalled</item>
    </style>

    <!-- this style is only referenced in a Light.DarkActionBar based theme -->
    <style name="Theme.Light_appalled.Widget" parent="@style/Theme.AppCompat">
        <item name="popupMenuStyle">@style/PopupMenu.Light_appalled</item>
        <item name="dropDownListViewStyle">@style/DropDownListView.Light_appalled</item>
    </style>






</resources>

不幸的是

<item name="android:windowNoTitle">true</item>

没有用,所以我想弄明白该怎么做。

0 个答案:

没有答案