Style actionbar background 3.0

来源:互联网 发布:才真旺姆解释双修 知乎 编辑:程序博客网 时间:2024/06/14 06:17

自定义actionBar
1、新建themes.xml
2、自定义style 继承当前主题 (android:style/Theme.Holo)重写android:actionBarStyle 名字对应下面的style
3、自定义名字 继承 背景颜色(android:style/Theme.Holo.Light.ActionBar.Solid.Inverse)
4、重写该类下的android:background方法,内容为背景资源;
以下是Demo

<?xml version="1.0" encoding="utf-8"?><resources>    <!-- the theme applied to the application or activity -->    <style name="CustomActionBarTheme"           parent="@android:style/Theme.Holo.Light.DarkActionBar">         <item name="android:actionBarStyle">@style/MyActionBar</item>    </style>    <!-- ActionBar styles -->    <style name="MyActionBar"           parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">        <item name="android:background">@drawable/actionbar_background</item>    </style></resources>
0 0
原创粉丝点击