不能改变的动作条分颜色 [英] can't change color of actionBar divider

查看:148
本文介绍了不能改变的动作条分颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图改变颜色的我的动作条护栏,但没有工作。我使用Android的支持库V7支持老设备和自定义样式,我也改变所有动作栏绘制,但没有发生的事情!

I tried change color of my actionBar divider , but nothing work. I' using android support library v7 for support old devices and custom style, and i also change all action bar drawable, but nothing happend!

<resources>
    <style name="MyTheme" parent="Theme.AppCompat">
        <item name="actionBarStyle">@style/MyActionBar</item>
    </style>

    <style name="MyActionBar" parent = "Widget.AppCompat.ActionBar">
        <item name="background">@drawable/my_action_bar</item>
    </style>
</resources>

和我的IDE让我奇怪的错误布局,为什么我得到这个错误?它不是颜色值

And my ide show me strange error in layout , why did i get this error? it's not color value

java.lang.NumberFormatException: Color value '@drawable/abs__ab_transparent_dark_holo' must start with #

解决方法:需要加android的命名空间,如果使用的API级别> = 14。可能是这将是有帮助的人。

Solution: Need to add android namespace if use for api level >= 14 .May be it will be helpful to someone.

推荐答案

这是因为分是一个形象。很难codeD上的全息主题的资产。

It is because the "divider" is an image. It's hardcoded in the Holo theme assets.

看平台/ Android为19 /数据/ RES /绘制-xxhdpi / ab_transparent_dark_holo.9.png

Look at platforms/android-19/data/res/drawable-xxhdpi/ab_transparent_dark_holo.9.png

的风格在这里宣布了全息暗。

The style is declared here for holo dark.

<style name="Widget.Holo.ActionBar" parent="Widget.ActionBar">
        ...
        <item name="android:background">@android:drawable/ab_transparent_dark_holo</item>
        ...
</style>

这是一个背景。你需要改变颜色的图像和更换栏的背景。 它也需要不同的大小不同的分辨率。

It's a background. You will need to change the color in the image and replace the background of your bar. It also needs different sizes for different resolutions.

这篇关于不能改变的动作条分颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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