Android 4.0 and custom title bar not working

I have an Android 2.3.3 app where I am setting some custom titles like:

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 of these lines are written to onCreate ().

In android 2.3.3 everything works fine. Now I am trying to make the same Android 4.0 app, but I have a problem setting up a custom title bar. I got 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.

+3


source to share


1 answer


I solved it by installing another theme, for example:

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



in the file AndroidManiest.

+7


source







All Articles