2012-04-02 74 views
3

我已经为Android 2.3.3应用程序,其中我设置了一些自定义标题是这样的:Android 4.0及自定义标题栏不工作

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"); 
    } 

所有这些线路在的onCreate writen()。

在android 2.3.3中,一切正常。我现在正在尝试为android 4.0制作相同的应用程序,但我在设置自定义标题栏时遇到了问题。我有这个错误:

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

我需要帮助来解决这个错误。

我的类的定义是这样的:

MDPIActivity extends Activity implements OnGestureListener, AnimationListener 

谢谢。

的android:主题= “@安卓风格/ Theme.Black”

在AndroidManiest文件

回答

7

我设置另一个主题,就像thise一个解决这一点。