我想知道如何设置自定义颜色,因为当我在棒棒糖主题中设置背景颜色时,它会告诉我该颜色不被允许。
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.MyTheme" parent="Theme.AppCompat.Light">
<!-- colorPrimary is used for the default action bar background -->
<item name="colorPrimary">#FF0099</item>
<!-- colorPrimaryDark is used for the status bar -->
<item name="colorPrimaryDark">#FF0099</item>
<!-- colorAccent is used as the default value for colorControlActivated,
which is used to tint widgets -->
<item name="colorAccent">#339900</item>
<item name="android:textColorPrimary">#FFFFFF</item>
<item name="android:windowBackground">#f06292</item>
<!-- You can also set colorControlNormal, colorControlActivated
colorControlHighlight, and colorSwitchThumbNormal. -->
</style>
</resources>
我遇到了一个问题,显示错误信息:Error: Color types not allowed (at 'android:windowBackground
' with value '#f06292')。我不知道该怎么办。
最后一个问题是如何从代码中调用所有这些函数。