Android运行异常处理: You cannot combine custom titles with other title features
把一个原来2.2 的应用,在4.0.4下编译运行后提示
android.util.AndroidRuntimeException: You cannot combine custom titles with other title features
查看代码发现用了自定义title
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.main);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title);
这个自定义的title在4.0 以上版本会出错,解决办法是在 在AndroidManifest.xml 在<application>段指定应用一个主题即可:
android:theme="@android:style/Theme.Black"
仔细查看4.0新建应用,都会自动加入这一句
<application android:label="@string/app_name"
android:icon="@drawable/ic_launcher"
android:theme="@style/AppTheme" >