android 4.0自定义标题栏,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");

}

所有这些行都在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文件中.

标签:android,android-titlebar

来源: https://codeday.me/bug/20190729/1573837.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值