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

Troy Machado
PLUS
Troy Machado
Courses Plus Student 570 Points

Background color will not change in Android Studio 3.0.1

No matter what I do, whether I use the color code or the pre-loaded color, the background will not change. I have had a lot of issues with this version and want to know if it is just a bug or if I am doing something wrong.

Ben Deitch
Ben Deitch
Treehouse Teacher

Sounds like a bug. Though if you'd like, post your XML layout and I can double check it.

1 Answer

Melanie Myers
Melanie Myers
9,154 Points

It seems like Studio is trying to make you stick to colors in a theme. You'll need to add the color to the project by going to res -> values -> colors.xml. Duplicate one of the existing color lines and modify for the background color.

Then go back to the layout where you are trying to set the color and click the ... next to background. Go to "Color" on the left and under project you should see the color you just added.

There may be an easier way to do it, but this is how I got it to work :)