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

Norvell Robinson
Norvell Robinson
9,775 Points

how to add background images instead of colors

In the video it shows us how to add colors randomly to our app, but what if I wanted to change the background image?

1 Answer

Omar Emara
Omar Emara
18,249 Points

On any view, you can use the method setBackground(Drawable background) https://developer.android.com/reference/android/view/View.html#setBackground(android.graphics.drawable.Drawable) Save the image resource in the drawable folder and use it.