<style name="WindowTitleBackground">
        <item name="android:background">#7f7f7f</item><!--此处为标题栏背景颜色-->
 </style>    <style name="titlebar_style" parent="android:Theme">
 <item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item>       
        <item name="android:background">#ff0000</item><!--此处设置背景颜色为红色,但是这里的背景颜色将标题栏的背景颜色给冲了,也就是整个activity,标题栏和内容的背景颜色都是红色,求解如何恢复标题栏背景颜色-->
    </style>

解决方案 »

  1.   

    把<item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item>       改成<item name="android:windowTitleBackgroundStyle">@style/WindowTitleBackground</item>       
      

  2.   

    把<item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item>       改成<item name="android:windowTitleBackgroundStyle">@style/WindowTitleBackground</item>       
    不好意思,这个是粘贴的时候粘贴错了,源代码就是@style/WindowTitleBackground
      

  3.   

    我在Manifest的application标签下定义了android:theme="@style/titlebar_style",出来的效果是正常的,没像你说的标题栏背景色也变成了红色。你查一下是不是其他地方写的有问题。