簡體   English   中英

Android 4.0和自定義標題欄不起作用

[英]Android 4.0 and custom title bar is not working

我有一個Android 2.3.3的應用程序,我正在設置一些這樣的自定義標題:

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()中寫入。

在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

謝謝。

我通過設置另一個主題來解決這個問題,例如:

機器人:主題= “@安卓風格/ Theme.Black”

在AndroidManiest文件中。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM