android.util.AndroidRuntimeException: You cannot combine custom titles with other title features

来源:互联网 发布:佳为软件标志 编辑:程序博客网 时间:2024/05/16 14:02

在做项目的时候自定义一个TitleBar,但是,其中是用到TabHost + ActivityGroup  左右滑动的时候,由于TabHost中有个默认的titleBar 而在哪个自己的主界面也有一个titlebar 两个冲突了所以会报错android.util.AndroidRuntimeException: You cannot combine custom titles with other title features;

      在网上找了一些关于这些错的解决方法 也没能成功,最后慢慢调试;

      requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
        setContentView(R.layout.main);
        getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, 

去掉这两句:      requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
                            getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, 

直接在你想要的manifest中添加你的自定义的titilebar的主题就行了 eg:

<activity
            android:name="com.front.toyota.ui.MainActivity"
            android:theme="@style/titlebar" >//--------------------------添加这句就行
            <intent-filter>
              <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

0 0