<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);"> </span><span style="font-size:18px;font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">Android中可以设置ActionBar的背景色,这个是我设置的自己的背景图片,背景为蓝色:</span>
下面是themes.xml文件,和style.xml文件一样,也属于样式文件,在themes.xml里面定义的样式在配置文件里使用的。
<?xml version = "1.0" encoding = "utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style
name = "CustomActionBar"
parent = "@android:style/Theme.Holo.Light.DarkActionBar"
>
<item name = "android:actionBarStyle" >@style/CustomBackGround</item>
</style>
<style
name = "CustomBackGround"
parent = "@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse"
>
<item name = "android:background">@drawable/tiao</item>
</style>
</resources>
配置文件里面,我们使用这一行代码即可:
android:theme="@style/CustomActionBar" >
下面是效果图: