Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Simple Android App with Java Creating the Screen Layout Setting Colors

Eniolal Oladipo
Eniolal Oladipo
1,151 Points

color code; what did I do wrong here

what did I do wrong here

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:text="Treehouse loves me!"

    android:textSize="72sp" />


2 Answers

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

When you're doing hex color codes, they should not be preceded by @android:color/ - it should just be #fff092b0 as a string.

Rebecca Rich
Rebecca Rich
Courses Plus Student 8,592 Points

There are a list of System Color Constants: https://developer.android.com/reference/android/R.color; which is what @android:color/white is based on. This should work for the first part of the challenge.

The second part asks you to use a HEX color format instead of the System Color Constants to set the background color for the RelativeLayout, so you just need to replace "@android:color/white" with "#fff092b0" which represents a dark pink color. Android supports the following color format: "#AARRGGBB" where AA represents the alpha, in this case 100% represented by FF, and "RRGGBB" is the standard HEX representation for dark pink or #F092B0". Here is more info on color codes: https://stackoverflow.com/questions/15852122/hex-transparency-in-colors