小编Dav*_*ghn的帖子

Android 4.0和自定义标题栏不起作用

我有一个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");
  }
Run Code Online (Sandbox Code Playgroud)

所有这些行都在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
Run Code Online (Sandbox Code Playgroud)

我需要帮助才能解决此错误.

我的课程定义如下:

MDPIActivity extends Activity implements OnGestureListener, AnimationListener
Run Code Online (Sandbox Code Playgroud)

谢谢.

android android-titlebar

3
推荐指数
1
解决办法
3965
查看次数

标签 统计

android ×1

android-titlebar ×1