我正在尝试将一个主题应用到我的操作栏,这将改变背景颜色。但是,当我这样做时,应用程序的整个背景会发生变化......
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="android:actionBarSize">140dp</item>
<item name="android:background">#00ff00</item>
</style>
有谁知道如何将单独的主题应用到操作栏?
感谢。
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="android:actionBarStyle">@style/MyActionBar</item>
<item name="android:actionBarSize">140dp</item>
<item name="android:background">#ffffff</item>
</style>
<!-- ActionBar LAYOUT -->
<style name="MyActionBar" parent="android:Widget.ActionBar">
<item name="android:background">#000000</item>
</style>
答案 0 :(得分:2)
你必须这样做:
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:actionBarStyle">@style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="android:Widget.Holo.ActionBar" >
<item name="android:background">@android:drawable/action_bar_background</item>
</style>
这是你改变背景的方法:
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:actionBarStyle">@style/MyActionBar</item>
<item name="android:colorBackground">@android:color/black</item>
</style>