覆盖默认的Andr​​oid主题

覆盖默认的Andr​​oid主题

本文介绍了覆盖默认的Andr​​oid主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经能够覆盖有名称的主题为机器人prepended给他们,但在Android的themes.xml还定义属性似乎不能够被覆盖。例如:

I've been able to override any themes that have names with "android:" prepended to them, but the Android themes.xml also defines properties that don't seem to be able to be overridden. For example:

<!-- Variation on the Light theme that turns off the title -->
<style name="Theme.Codebase" parent="android:style/Theme.Light">
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="colorBackground">@color/off_white</item>
</style>

colorBackground是在Theme.Light XML定义,但在这里加入这给了我一个

colorBackground is defined in the Theme.Light xml, but adding this here gives me a

/res/values/styles.xml:10: error: Error: No resource found that matches the given name: attr 'colorBackground'.

错误。我如何覆盖风格的应用程序作为一个整体?

error. How do I override that style for the Application as a whole?

推荐答案

您可以覆盖标准的属性,您修改性能如 windowNoTitle 以同样的方式,只是不要忘了添加机器人: preFIX是这样的:

You can overwrite standard attributes the same way you modified such properties as windowNoTitle, just don't forget to add android: prefix like this:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="SEclubTheme" parent="@android:style/Theme">
        <item name="android:colorForeground">@color/bright_foreground_dark</item>
        <item name="android:colorBackground">@color/background_dark</item>
    </style>
</resources>

这篇关于覆盖默认的Andr​​oid主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 14:11