我有一个适用于 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
谢谢。
最佳答案
我通过设置另一个主题来解决这个问题,比如这个:
android:theme="@android:style/Theme.Black"
在 AndroidManifest 文件中。
关于Android 4.0 和自定义标题栏不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9971696/