小编LEA*_*454的帖子

如何为WindowBackground设置自定义颜色

我想知道如何设置自定义颜色,因为当我在棒棒糖主题中添加颜色背景时,我说这种颜色是不允许的.

<?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>
Run Code Online (Sandbox Code Playgroud)

我有问题要说我错误:错误:颜色类型不允许(在' android:windowBackground'有值'#f06292').我不知道我该做什么.

最后一件事是如何从代码中调用所有这些函数.

android colors

3
推荐指数
1
解决办法
5168
查看次数

标签 统计

android ×1

colors ×1