错误添加自定义主题,以应用程序 [英] Error adding custom theme to app

查看:528
本文介绍了错误添加自定义主题,以应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我增加了以下主题我的应用程序与white.But我收到以下错误背景颜色,我不知道,我已经错了。

I added the following theme to my app with a background color of white.But I get the following error and I'm not sure where I have gone wrong.

错误:不允许彩种。(在安卓windowBackground,值为#FF0000)

<style name="MyTheme" parent="@android:style/Theme.Light"> 
  <item name="android:windowBackground">#FF0000</item>
 </style>

和引用的主题mymanifest:

And referenced the theme in mymanifest:

<activity
        android:name=".MyActivity"
        android:theme="@style/MyTheme" />

任何意见或建议?谢谢

Any ideas or suggestions? Thanks

推荐答案

按照的Andr​​oid样式和主题页面,你必须使用一个单独的颜色资源来设置颜色。

According to the Android Styles and Themes page, you have to use a separate color resource to set the color.

(注意,色彩需要这里提供作为单独的资源   因为机器人:windowBackground属性只支持   参考其他资源;不像安卓:colorBackground,它可以   不能给予一个颜色的文字。)

(Note that the color needs to supplied as a separate resource here because the android:windowBackground attribute only supports a reference to another resource; unlike android:colorBackground, it can not be given a color literal.)

例如

<item name="android:windowBackground">@color/custom_theme_color</item>

这篇关于错误添加自定义主题,以应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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