转 Android 4.0后,自定义Title报错 You cannot combine custom titles with other title feature

 
自定义Titlebar时为了避免冲突

需要修改:AndroidManifest.xml

android:theme="@style/mystyle" 

styles.xml文件中需要加上下面内容

<style name="mystyle" parent="android:Theme">
<item name="android:windowTitleSize">50dp</item>
</style>
 
下面是网上别人的详细分析:
[Java] 纯文本查看 复制代码
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
<application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/TitleBarStyle">
        <activity
            android:name="com.example.b.MainActivity"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
 
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>



有可能是@style/AppTheme里面设了这个值吧?于是我再看values/styles.xml文件

看到别人博客上还有一个解决的方案:

在style.xml中修改加入这句“ <item name="android:windowActionBar">false</item>”

[html] view plaincopy
 
 
  1. <style name="AppTheme" parent="AppBaseTheme">  
  2.     <!-- All customizations that are NOT specific to a particular API-level can go here. -->  
  3.     <item name="android:windowActionBar">false</item>  
  4. </style>