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 (2014) Creating the Screen Layout Setting Colors

Eugene Lombard
Eugene Lombard
735 Points

Your hex value for dark pink: #fff092b0 two characters too many...now I cant go on..??

Your hex value for dark pink: #fff092b0 two characters too many...now I cant go on..??

activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:background="@android:color/#ff092b" >

  <TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:text="Treehouse loves me!"
    android:textSize="72sp" 
    android:textColor="@android:color/white" />


</RelativeLayout>
David Anton
David Anton
Courses Plus Student 30,936 Points

Hi Eugene,

The hex value in Android studio combined with 8 characters from 1-F.

First two Characters is the transparency, and the 6 other characters is normal hex color.

Examples:

1) Red = #ffff0000.

2) Green = #ff00ff00.

3) Blue = #ff0000ff.

3 Answers

Eugene Lombard
Eugene Lombard
735 Points

Hey,

Yes I saw that and actually commented on that afterwards thanks. But I still cannot get past that one, I manually moved on and all fine, but still cannot get past this one. I tried again now and still no luck?

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/#fff092b0" >

<TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="Treehouse loves me!" android:textSize="72sp" android:textColor="@android:color/white" />

Here is the code again, dont understand what the issue is?

Eugene Lombard
Eugene Lombard
735 Points

I dont get it? Why would the code suddenly change from what I know it should be, are there different code to do the same thing?? Or at least, why does the test do it that way?

David Anton
David Anton
Courses Plus Student 30,936 Points

The prefix of the color "@android:color/" that's mean to pick color from android color library. Try to open Android studio and then change the backgroud color from "Design" view, you will see at the top of the dialog three tabs.

1) Project : Colors that you have been initialized in /res/values

2) System : Colors from Android library and have a prefix of @android:color/

3) Color : Custom Color to pick.