Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
447 views
in Technique[技术] by (71.8m points)

android - 如何在Android应用中更改背景颜色(How to change background color in android app)

我希望能够以最简单的方式在我的android应用中将背景颜色更改为白色。

  ask by ryan translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You need to use the android:background property , eg

(您需要使用android:background属性,例如)

android:background="@color/white"

Also you need to add a value for white in the strings.xml

(另外,您需要在strings.xml中为白色添加一个值)

<color name="white">#FFFFFF</color>

Edit : 18th Nov 2012

(编辑:2012年11月18日)

The first two letters of an 8 letter color code provide the alpha value, if you are using the html 6 letter color notation the color is opaque.

(8字母颜色代码的前两个字母提供了alpha值,如果您使用的是html 6字母颜色表示法,则颜色是不透明的。)

Eg :

(例如:)

在此处输入图片说明


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...