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

How to change background color and text in challenge task 1 of 2 of Android Dev?

Android Development Challenge task 1 of 2

2 Answers

Daniel Hartin
Daniel Hartin
18,106 Points

Hi Beau

Just a little advice:

It may be beneficial in future if you are struggling with a particular code challenge to reference the code challenge and posting any code you have so far, it does make it harder to guide you if I don't know what there asking you to do.

Challenge 1

Okay so the challenge is asking you change the textColor attribute in the TextView. I have added the line of code you need below (android:textColor="@android:color/white") this line uses the built in colors available to you courtesy of android. You could use a hexadecimal color code and that would be fine too.

Challenge 2

Okay in challenge 2 you are applying the same logic you did to edit the color of the TextView in challenge 1 only to the entire background color. This time however we aren't using a built in colour, we are defining our own color using a HEX format. We do this by using the tag (android:background="#fff092b0"). You could use a built in color easy enough if you wanted by using (android:background="@android:color/white") and that would work fine too.

The code you need for both challenges is below, or try it yourself using the above information.

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

    android:text="Treehouse loves me!"


Hope this helps


Hey Daniel, Thanks in a million. The code works and I really appreciate with your advice and it really motivates to work hard learning this track.