Search code examples
androidandroid-titlebar

Android 4.0 and custom title bar is not working


I have a application for android 2.3.3 where I am setting some custom titles like this:

final boolean customTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.main);

if ( customTitleSupported ) 
  {
     getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.titlebar);
  }

myTitleText = (TextView) findViewById(R.id.myTitle);

if ( myTitleText != null ) 
  {
     myTitleText.setText("MDPI - Main");
  }

All those lines are writen in onCreate().

In android 2.3.3, all is working fine. I am now trying to make the same application for android 4.0 but i have a problem with setting custom title bar. I am gotting this error:

E/AndroidRuntime(4225): Caused by: android.util.AndroidRuntimeException: You cannot combine custom titles with other title features

I need help to resolve this error.

My class is defined like this:

MDPIActivity extends Activity implements OnGestureListener, AnimationListener

Thank you.


Solution

  • I resolved this with setting another theme, like thise one:

    android:theme="@android:style/Theme.Black"

    in the AndroidManiest file.