在添加自定义的标题栏时,报错,you cannot combine custom titles with other titles...
AndroidManifest.xml中:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.umosleep"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/mystyle" >
<activity
android:name="com.umosleep.activity.MainTabActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.Light.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
mystyle.xml:
<resources>
<style name="CustomWindowTitleBackground">
<item name="android:background">#5baffd</item>
</style>
<style name="mystyle" parent="android:Theme">
<item name="android:windowTitleSize">50dp</item>
<item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item>
</style>
</resources>
Mainactivity.java:
onCreate()函数调用:
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.activity_bind);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.titlebar_bind);