如何使用Holo.Light主题,但在动作条使用全息withouth的ICS? [英] How to use the Holo.Light theme but have the ActionBar use Holo withouth ICS?

查看:146
本文介绍了如何使用Holo.Light主题,但在动作条使用全息withouth的ICS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想有一个黑暗的ActionBar但应用程序的其他部分使用Holo.Light主题。我知道有一个Theme.Holo.Light.DarkActionBar主题在ICS / 4.0,但我想这也是在蜂窝工作/ 3.0 +。

I would like to have a dark ActionBar but have the rest of the application use the Holo.Light theme. I know there is a Theme.Holo.Light.DarkActionBar Theme in ICS/4.0 but I want this also to work in Honeycomb/3.0+.

目前,我使用的是深色的Holo主题和我的其他组件,我使用的是ContextThemeWrapper。但是,这是很多的工作,很容易导致错误。

At the Moment I'm using the dark Holo theme and for the rest of my components I'm using a ContextThemeWrapper. But this is much work and can easily lead to errors.

这可能吗?

推荐答案

创建一个自定义样式,并设置父样式的全息光的主题,但在动作条正常的Holo。

Create a custom style and set the Parent style to the holo light theme but the ActionBar to normal Holo.

像这样的东西应该做的工作(只是我的记忆)XML文件:

a xml file with something like this should do the job (just out of my memory):

<style name="appstyle0" parent="android:style/Theme.Holo.Light">
    <item name="android:actionBarStyle">@android:style/Widget.Holo.ActionBar</item>
</style>

然后设置appstyle0在AndroidManifest.xml中的建筑风格,在所有的Activitys都是全息光的主题,但在操作栏风格是全息暗。

Then set the appstyle0 in your AndroidManifest.xml as style and in all your Activitys are holo light theme but the action bar style is holo dark.

编辑: 我查了一下,为什么我的第一个回答是行不通的。

I checked why my first answer does not work.

<style name="Widget.Holo.Light.ActionBar" parent="Widget.Holo.ActionBar">
    <item name="android:titleTextStyle">@android:style/TextAppearance.Holo.Widget.ActionBar.Title</item>
    <item name="android:subtitleTextStyle">@android:style/TextAppearance.Holo.Widget.ActionBar.Subtitle</item>
    <item name="android:background">@android:drawable/ab_transparent_light_holo</item>
    <item name="android:backgroundStacked">@android:drawable/ab_stacked_transparent_light_holo</item>
    <item name="android:backgroundSplit">@android:drawable/ab_bottom_transparent_light_holo</item>
    <item name="android:homeAsUpIndicator">@android:drawable/ic_ab_back_holo_light</item>
    <item name="android:progressBarStyle">@android:style/Widget.Holo.Light.ProgressBar.Horizontal</item>
    <item name="android:indeterminateProgressStyle">@android:style/Widget.Holo.Light.ProgressBar</item>
</style>

操作栏被定义在styles.xml与由一般的主旋律设置的属性。 首先所有的BG是透明的,所以你应该使用Widget.Holo.Light.ActionBar.Solid作为父母。 然后,你必须通过一个设置不同的项目一到黑暗的主题。 让我们titleTextStyle为例:

The action bar is defined in styles.xml with attributes that are set by the main theme in general. First of all the BG is transparent, so you should use "Widget.Holo.Light.ActionBar.Solid" as parent. Then you have to set the different items one by one to the dark theme. Lets take titleTextStyle as example:

<style name="TextAppearance.Holo.Widget.ActionBar.Title.Own"
       parent="TextAppearance.Holo.Widget.ActionBar.Title">
    <item name="android:textColor">@android:color/primary_text_holo_dark</item>
    <item name="android:textColorHighlight">@android:color/highlighted_text_holo_dark</item>
    <item name="android:textColorHint">@android:color/hint_foreground_holo_dark</item>
    <item name="android:textColorLink">@android:color/holo_blue_light</item>
</style>

现在把它设为。

<item name="android:titleTextStyle">@android:style/TextAppearance.Holo.Widget.ActionBar.Title.Own</item>

继续像这样与上面的XML属性。

Proceed like this with the xml attributes above.

要找到所有相关的属性在styles.xml和的themes.xml的参数搜索。 不好意思说,但我想有没有简单的方法,根据我所看到的...

To find all related attributes search in styles.xml and themes.xml for the parameters. Sorry to tell, but I guess there is no easy way, according to what I see...

这篇关于如何使用Holo.Light主题,但在动作条使用全息withouth的ICS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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