<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" >
下面是效果图:
本文介绍了如何在Android中设置ActionBar的背景色,并通过themes.xml和style.xml文件实现个性化定制,展示了一个使用自定义背景图片的示例。
654

被折叠的 条评论
为什么被折叠?



