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

Thomas Beaudry
Thomas Beaudry
29,084 Points

Hey, I will be finished with this course on Android, but this question isn't allowing me to finish

I've copied pasted the attribute but still no luck???? Thank you for ur help

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/white" >

  <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" />

</RelativeLayout>
Thomas Beaudry
Thomas Beaudry
29,084 Points

Their asking me to change the black text white in the text view???

Basically you're going to do some copying and pasting for this exercise. You see where the Relative Layout has the background color of "@android:color/white"? Well, that's the color you need to paste into your TextView. So, first create your attribute by adding "android:textColor= " after "android:textSize" and then paste in the @android color value from the above RelativeLayout. I will also add that you will very rarely change a color attribute in your xml file. The beauty of the IDE is that you can change these attributes in the Design View as well.

2 Answers

Thomas Beaudry
Thomas Beaudry
29,084 Points

Wilson ur the man...you hit it on the head it was a grammer mess up, thanks a million u saved my life man!!! Have a great weekend!!!

Happy to help! Have a great weekend!

Thomas Beaudry
Thomas Beaudry
29,084 Points

Yes, I tried that several times still is saying "error", I think its a very easy problem however its a technical error...maybe on thier end. Thanks a lot for taking time out much appreciated!

No problem Thomas. I went in and tried the problem again myself and I seemed to get it to pass. I'll paste in the code that I entered just for your reference. Make sure you're closing off the TextView after your textColor property with "/>"... That's really the only other potential error. Otherwise it's on their end and I can't explain it! :)

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

  <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>