Tom Leese
Tom Leese

Reputation: 19699

Action Bar Sherlock Dark theme with Light Theme + Dark Action Bar

I am using Action Bar Sherlock, and I'm wondering if there is a way to make the Action Bar Dark theme (Theme.Sherlock) use the same action bar from the Light + Dark Action Bar theme (Theme.Sherlock.Light.DarkActionBar).

Currently, these are my styles, but the dark theme still uses the dark action bar.

<style name="AppTheme.Light" parent="Theme.Sherlock.Light.DarkActionBar" />

<style name="AppTheme.Dark" parent="Theme.Sherlock">
    <item name="windowContentOverlay">@drawable/abs__ab_solid_shadow_holo</item>
    <item name="actionBarStyle">@style/Widget.Sherlock.Light.ActionBar.Solid.Inverse</item>
    <item name="actionBarWidgetTheme">@style/Theme.Sherlock</item>

    <item name="actionDropDownStyle">@style/Widget.Sherlock.Spinner.DropDown.ActionBar</item>
    <item name="actionButtonStyle">@style/Widget.Sherlock.ActionButton</item>
    <item name="actionOverflowButtonStyle">@style/Widget.Sherlock.ActionButton.Overflow</item>
    <item name="actionModeBackground">@drawable/abs__cab_background_top_holo_dark</item>
    <item name="actionModeSplitBackground">@drawable/abs__cab_background_bottom_holo_dark</item>
    <item name="actionModeCloseDrawable">@drawable/abs__ic_cab_done_holo_dark</item>
    <item name="homeAsUpIndicator">@drawable/abs__ic_ab_back_holo_dark</item>
    <item name="actionBarTabStyle">@style/Widget.Sherlock.Light.ActionBar.TabView.Inverse</item>
    <item name="actionBarTabBarStyle">@style/Widget.Sherlock.Light.ActionBar.TabBar.Inverse</item>
    <item name="actionBarTabTextStyle">@style/Widget.Sherlock.Light.ActionBar.TabText.Inverse</item>
    <item name="actionBarDivider">@drawable/abs__list_divider_holo_dark</item>
    <item name="actionBarItemBackground">@drawable/abs__item_background_holo_dark</item>
    <item name="actionMenuTextColor">?attr/textColorPrimaryInverse</item>
    <item name="actionModeStyle">@style/Widget.Sherlock.Light.ActionMode.Inverse</item>
    <item name="actionModeCloseButtonStyle">@style/Widget.Sherlock.ActionButton.CloseMode</item>
    <item name="actionModePopupWindowStyle">@style/Widget.Sherlock.PopupWindow.ActionMode</item>

    <item name="actionModeShareDrawable">@drawable/abs__ic_menu_share_holo_dark</item>
</style>

I copied all the style items from the Action Bar Sherlock source code.

Upvotes: 3

Views: 6827

Answers (1)

Nick
Nick

Reputation: 9373

I was just trying to do this too and found the solution here:

The easiest way to convey exactly what this entails is with an example. The following is the full theme from the “Styled” example mentioned above:

<style name="Theme.Styled" parent="Theme.Sherlock.Light.DarkActionBar">
    <item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>
    <item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item>
</style>

<style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse">
    <item name="background">@drawable/bg_striped</item>
    <item name="android:background">@drawable/bg_striped</item>

    <item name="backgroundSplit">@drawable/bg_striped_split</item>
    <item name="android:backgroundSplit">@drawable/bg_striped_split</item>
</style>

Upvotes: 3

Related Questions