【问题标题】:Changing ActionBar and SearchView backgrounds更改 ActionBar 和 SearchView 背景
【发布时间】:2012-04-24 05:44:17
【问题描述】:

我尝试按照android guidelines 的建议使用带有深色操作栏的 Holo Light 主题。

这是我的主题.xml 文件:

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

    <style name="Widget.MyApp.ActionBar" parent="@android:style/Widget.Holo.ActionBar">
        <item name="android:background">@android:drawable/dark_header</item>
        <item name="android:titleTextStyle">@style/MyApp.ActionBar.TextAppearance</item>
    </style>

    <style name="MyApp.ActionBar.TextAppearance" parent="@android:style/TextAppearance">
        <item name="android:textColor">@android:color/primary_text_dark</item>
    </style>
</resources>

不使用搜索界面的结果是预期的,但是当我使用SearchView时,背景来自Holo.Light主题:

有什么办法可以改变 ActionBar 上 SearchView 的默认样式?

【问题讨论】:

    标签: android android-theme android-actionbar android-searchmanager


    【解决方案1】:

    这看起来可能是你的答案:

    How do I keep ActionBar items' background the same...

    简而言之:

    尝试替换

    &lt;item name="android:background"&gt;@android:drawable/dark_header&lt;/item&gt;

    &lt;item name="android:windowBackground"&gt;@android:drawable/dark_header&lt;/item&gt;

    【讨论】:

      【解决方案2】:

      This link is most useful to create theme of actionbar in android.愿这个对你也有用..

      您只需创建并保存 xml 文件并放入相应的文件夹中。

      谢谢。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-03-03
        • 2015-08-14
        • 1970-01-01
        • 2014-03-05
        • 1970-01-01
        • 2015-07-25
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多