无法更改Sherlock ActionBar中的警报对话框主题

时间:2013-09-19 04:24:07

标签: android android-actionbar actionbarsherlock

我有一个带有主题DarkActionBar的Sherlock Action Bar,所以我可以在Action Bar中获得白色搜索图标。

但是,当我这样做我的contextMenu的子菜单(用popUp决定 - 就像一个AlertDialog)时,这个对话框的主题就像它的父对象一样黑暗,我想要它Light。

我该怎么做?获取上下文菜单选项的白色搜索图标(黑暗主题)和Light主题?

这是我的styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="StyledIndicators" parent="@style/Theme.SherlockCustom">
      <item name="vpiTabPageIndicatorStyle">@style/CustomTabPageIndicator</item>
      <item name="vpiTabTextStyle">@style/CustomTabPageIndicator.Text</item>
    </style>

    <style name="CustomTabPageIndicator" parent="Widget.TabPageIndicator">
        <item name="android:background">@drawable/custom_tab_indicator</item>
    </style>
    <style name="CustomTabPageIndicator.Text" parent="Widget.TabPageIndicator.Text">
        <item name="android:textColor">#FF555555</item>
    </style>
    <style name="CustomTheme.TitleActionBar" parent="@style/TextAppearance.Sherlock.Widget.ActionBar.Title">
        <item name="android:textColor">#FFFFFF</item>
    </style>
    <style name="CustomTheme.ActionBarStyle" parent="Widget.Sherlock.ActionBar">
        <item name="background">@drawable/gradiente_titlebar</item>
        <item name="android:background">@drawable/gradiente_titlebar</item>
        <item name="titleTextStyle">@style/CustomTheme.TitleActionBar</item>
        <item name="android:titleTextStyle">@style/CustomTheme.TitleActionBar</item>
    </style>
    <style name="Theme.SherlockCustom" parent="@style/Theme.Sherlock.Light.DarkActionBar">
        <item name="actionBarStyle">@style/CustomTheme.ActionBarStyle</item>
        <item name="android:actionBarStyle">@style/CustomTheme.ActionBarStyle</item>
        <item name="spinnerDropDownItemStyle">@style/Theme.Sherlock.Light</item>
        <item name="android:spinnerDropDownItemStyle">@style/Theme.Sherlock.Light</item>
        <item name="spinnerItemStyle">@style/Theme.Sherlock.Light</item>
        <item name="android:spinnerItemStyle">@style/Theme.Sherlock.Light</item>
        <item name="popupMenuStyle">@style/Theme.Sherlock.Light</item>
        <item name="android:popupMenuStyle">@style/Theme.Sherlock.Light</item>
        <item name="actionDropDownStyle">@style/Theme.Sherlock.Light</item>
        <item name="android:actionDropDownStyle">@style/Theme.Sherlock.Light</item>
        <item name="android:alertDialogStyle">@style/Theme.Sherlock.Light</item>
    </style>
</resources>

1 个答案:

答案 0 :(得分:2)

https://stackoverflow.com/a/15219098/1574617找到答案。

刚刚将其添加到代码中,现在我可以决定要使用哪个小部件搜索。 感谢ASP的回答。

<style name = "Theme.SherlockCustom" parent = "@style/Theme.Sherlock.Light">
    <item name = "actionBarWidgetTheme"> @style/Theme.Sherlock.Light.DarkActionBar </item>
    <item name = "android:actionBarWidgetTheme"> @style/Theme.Sherlock.Light.DarkActionBar </item>

    <item name = "actionBarStyle"> @style/CustomTheme.ActionBarStyle </item>
    <item name = "android:actionBarWidgetTheme"> @style/CustomTheme.ActionBarStyle </item>  
</style>

感谢ASP的回答。