我已经能够覆盖名称前面带有“android:”的任何主题,但 Android themes.xml 还定义了似乎无法覆盖的属性。例如:
<!-- 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 中定义的,但是在这里添加它会给我一个
/res/values/styles.xml:10: error: Error: No resource found that matches the given name: attr 'colorBackground'.
错误。如何覆盖整个应用程序的样式?
最佳答案
您可以像修改 windowNoTitle
等属性一样覆盖标准属性,只是不要忘记像这样添加 android:
前缀:
<?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>
关于java - 覆盖默认的 Android 主题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4833947/