3

私は次のようなカスタムタイトルを設定している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

ありがとうございました。

4

1 に答える 1

7

thiseのような別のテーマを設定してこれを解決しました:

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

AndroidManiest ファイルにあります。

于 2012-04-02T06:46:12.053 に答える