设置标题栏背景
1> 准备背景图片: background_pix.png
注:用背景图片比用颜色好处,可以让背景看起来有凹凸感.
2> drawable文件夹下放xml文件
bitmap_repeat.xml
android:src="@drawable/title_pic"
android:tileMode="repeat">
3> 定义样式文件style.xml
@drawable/bitmap_repeat
@style/StatusBarBackground
4> 在manifest.xml中引用主题android:theme="@style/XTheme"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|orientation"
android:theme="@style/XTheme">
自定义标题栏layout文件ct_title.xml
注: ct_title.xml文件中用如下方式设置标题栏背景会出下填充不满效果
android:background="@drawable/bitmap_repeat