设置所有屏幕的活动背景颜色 [英] Setting activity background color of all screens
本文介绍了设置所有屏幕的活动背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试通过声明主题为我的所有应用活动添加背景颜色但是当我在xaml声明中添加十六进制颜色代码时,我在十六进制代码上出现错误。代码如下:
在res / values中创建一个themes.xml文件:
< 资源 >
< style 名称 = MyTheme parent = @ android :style / Theme.Light >
< item 名称 = android: windowBackground > #FF0000 < / item >
< / style >
< / resources >
...然后在你的AndroidManifest中。 xml将此指定为您要使用的活动的主题。
< 活动
< span class =code-attribute> android:name = 。MyActivity
android:theme = @ style / MyTheme / >
解决方案
< blockquote>你在十六进制代码上得到的错误是什么?请检查此 [ LINK ]了解如何实现它。
I''m trying to add a background color to all my app activities by declaring a theme but when I add a hex color code in the xaml declaration I get an error on the hex code.The code is as follows:
Create a themes.xml file in res/values:
<resources>
<style name="MyTheme" parent="@android:style/Theme.Light">
<item name="android:windowBackground">#FF0000</item>
</style>
</resources>
... and then in your AndroidManifest.xml specify this as the theme for your activities to use.
<activity
android:name=".MyActivity"
android:theme="@style/MyTheme" />
解决方案
What is the error you are getting on the hex code? Please check this [LINK] to understand how you can achieve it.
这篇关于设置所有屏幕的活动背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文