Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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!