What is the hex code for the default white background that is given to layouts when you create a new project?
Asked
Active
Viewed 1,896 times
1 Answers
1
This answer shows you to get the default background color.
To summarize, just do something like this
TypedValue a = new TypedValue();
getTheme().resolveAttribute(android.R.attr.windowBackground, a, true);
int color = a.data;
Then color
will contain the value. This might be useful because the background might be different across different platforms (as the javadoc mentions, you can only count on the background being light).
-
The `color` variable will contain the correct hex code (albeit in the form of an integer rather than a String). If you just want the hex code of the image you posted, I suggest using the "paint test" tool in an image manipulation system to give you the value. – k_g Feb 23 '15 at 22:54