2012-04-02 43 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一個解決這一點。