How do I keep ActionBar items' background the same while changing the app's main background?

橙三吉。 提交于 2019-12-11 12:18:24

问题


I am trying to change the background of the app, but when I do the below (sdk 14) the items in the actionbar also change to match the new background color. The actionbar itself has the correct background, but the items in the actionbar do not. I was able to get the actionbarmenuitems to be correct, but the title and search view and home icon and back button all have the background set on the custom theme. What am I doing wrong?

<?xml version="1.0" encoding="utf-8"?>
<resources>
   <style name="Theme.Holo.DarkerBack" parent="@android:style/Theme.Holo.Light.DarkActionBar">
      <item name="android:background">@color/background</item>
      <item name="android:actionBarStyle">@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse</item>
   </style>
</resources>


回答1:


Try replacing

<item name="android:background">@color/background</item>

with

 <item name="android:windowBackground">@color/background</item>


来源:https://stackoverflow.com/questions/10146078/how-do-i-keep-actionbar-items-background-the-same-while-changing-the-apps-main

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!