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

Taiwo O
Taiwo O
2,173 Points

res Drawable files

I'm trying to create a quick app that sets an image as the background of an android device. In these tutorials, the drawable files that are designed to fit all phones are always provided for us but i would like to know how to go about making a single image, which i want to set as the background, compatible with all the xhdpi, hdpi, xxhdpi, etc. Thanks.

1 Answer

Jacob Bergdahl
Jacob Bergdahl
29,118 Points

Visit http://density.brdrck.me/ to easily see how to convert to support all the resolutions. If you want to make a background image that covers the entire screen, here are the values to go for:

LDPI: 240 x 360
MDPI: 320 x 480
TVDPI: 426 x 639
HDPI: 480 x 720
XHDPI: 640 x 960
XXHDPI: 960 x 1440
XXXHDPI: 1280 x 1920

MDPI is at 100%, so make an image in MDPI and then resize it to fit different resolutions. Vector graphics will make scaling images easy.

Taiwo O
Taiwo O
2,173 Points

Thank you so much!