Feature Custom Title: Cannot combine custom titles on API 11 and above

11,656

Solution 1

Fixed by my self. I don't know why, but simply adding in manifest file "theme" property for each activity's declaration, all works:

From this:

<activity
        android:name=".CheckActivity"
        android:configChanges="orientation"
        android:screenOrientation="portrait"
</activity>

To this:

<activity
        android:name=".CheckActivity"
        android:configChanges="orientation"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme" >
</activity>

Solution 2

@kinghomer I have tried CUSTOM_TITLE its on 2.2 (API 8) actually. Let me try on API 11 and get back to you!

Before that, you need not make Theme.NoTitleBar anywhere, can be controlled in .java file directly. Give me some time, will be back!

Share:
11,656
kinghomer
Author by

kinghomer

Updated on June 04, 2022

Comments

  • kinghomer
    kinghomer about 2 years

    I have a project in which i setted:

    • minSdkversion setted to 10
    • MainActivity is a TabActivity

    Code in onCreate method is this:

    super.onCreate(savedInstanceState);
    
    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    setContentView(R.layout.main);
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title);
    ...
    

    With previous settings, all works well! But, if i set minSdkVersion to 11 or above, this exception occurs:

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

    I don't understand why happens this just changing minSdkVersion. I red a lot about this problem on this site. I tried setting:

    • Theme.NoTitleBar in main layout and after in Manifest file too
    • I put those 3 lines in all possible positions
    • If i comment first line a NullPointerException occurs when i call something on my TextView reference of my CustomTitle layout
    • I tried setting, in theme.xml file declaration, "windowNoTitle" = true

    Since i'm using functions available from API 11 only, i want to set minSdk to 11 before loading App on Store. How can i do ?? I need Help

    Edit: With minSdkVersion = 10 and Theme.NoTitleBar in Manifest, same error occurs. Removing it, all works as before. Can anyone provide a working code (manifest and activity code) for setting a custom title when API is 11 or above ? Thx much