You cannot combine custom title with other title features

前端 未结 2 1309
攒了一身酷
攒了一身酷 2021-01-06 10:42

In my application, I\'m using ActionBarSherlock library. Also I\'m using a custom title bar. Here goes my onCreate:

requestWindowFeature(Window.FEATURE_CUSTO         


        
2条回答
  •  花落未央
    2021-01-06 11:21

    I received the same exception.

    Here is what I found: In newer versions of Android, the framework will use the Window.FEATURE_ACTION_BAR feature whenever the Holo theme is selected. The framework throws the exception whenever an app calls setFeatureInt(Window.FEATURE_CUSTOM_TITLE) and FEATURE_ACTION_BAR has already been set.

    In my case, the styles.xml file in the values-v11 folder was redefining my theme to inherit from android:Theme.Holo. When I attempted to run my app on a Android 3.0 or above - it crashed because Holo uses the ActionBar by default. The fix was simple. Turn the ActionBar off when using Holo. Here is the revised values-v11\styles.xml changes:

    
    

提交回复
热议问题