是否霍洛主题自定义标题栏的工作? [英] Does Holo Theme work with custom titlebar?

查看:114
本文介绍了是否霍洛主题自定义标题栏的工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经得到了使用下面的样式应用主题绘制一个自定义标题栏的应用程序:

I've got an application that draws a custom title bar using the following style for the application theme:

<style name="App_Theme" parent="android:Theme">
    <item name="android:windowTitleSize">30dip</item>
    <item name="android:windowTitleBackgroundStyle">@style/App_TitleBackground</item>
</style>

这并没有给我的全息主题。所以我设置的母公司=@安卓风格/ Theme.Holo。该应用程序崩溃并出现以下错误:

This does not give me the holo theme. So I set the to parent="@android:style/Theme.Holo". This crashes the application with the following error:

E / AndroidRuntime(2048):android.util.AndroidRuntimeException:产生的原因不能与其他标题功能结合自定义标题

E/AndroidRuntime(2048): Caused by: android.util.AndroidRuntimeException: You cannot combine custom titles with other title features

它是不允许使用使用自定义标题栏:

Is it disallowed to use custom title bar using:

 requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);

还是我失去了一些东西?

Or am I missing something here?

PS:

  • 的code工作完全正常与设置为父。安卓主题

  • 我使用的API级别14
  • 推荐答案

    多数用于未来游客的利益,不能使用 Window.FEATURE_CUSTOM_TITLE 霍洛主题。设置的android:windowActionBar 是不是我想要的,因为我想一个标题栏,虽然定制的。

    Mostly for the benefit of future visitors, one cannot use Window.FEATURE_CUSTOM_TITLE with Holo themes. Setting android:windowActionBar is not what I wanted, since I wanted a title bar, although a customized one.

    我的解决方法,是 requestWindowFeature(Window.FEATURE_NO_TITLE)并添加另一个布局,看起来像在我的活动标题栏。这样一来,我得到两全其美的。

    My workaround, was to requestWindowFeature(Window.FEATURE_NO_TITLE) and add another layout that looked like a titlebar in my activity. That way, I get the best of both worlds.

    这篇关于是否霍洛主题自定义标题栏的工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆