在4.0在自己之上的标题栏定义

需要设置一些代码:

	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>


 

posted on 2015-12-15 19:21  gcczhongduan  阅读(102)  评论(0编辑  收藏  举报