需要设置的几句代码:
private void setCustomTitle() {
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.main);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
R.layout.customtitle);
}
另外要引用自定义的样式:
<style name="CustomizedWindowTitleBackground">
<item name="android:background">#044BF6</item>
</style>
<style name="titlebarstyle" parent="android:Theme">
<item name="android:windowTitleSize">48dp</item>
<item name="android:windowTitleBackgroundStyle">@style/CustomizedWindowTitleBackground</item>
</style>
原文:http://blog.csdn.net/u010142437/article/details/40505713