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!
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
Lucas Santos19,315 Points
Android Drawables sizes
Question about Drawables in Android Development. I understand how there is different drawable folders within the resources folder so that we can target different device sizes but now here is the part that I am confused about.
So lets just say were talking about the design here so i'll use photoshop for this example. Let say we have an app to make that has a background of an Car that takes up the entire background of the mobile device, and we want to show that "car background image" to the best of it's potential on all devices.
What Dimensions and DPI would you start your app background image of the car on?
And also I am coming from Web Development and the way we target different screen sizes is by having 1 large image and scaling that down so it does not lose image quality.
Why can't we do the same in android development? Why can't we just use one large image in the the drawable-xhdpi and have that scale down for all devices?
So really im more confused about how we get images or background images to look the way you want it to look as far as proportion and size goes on different devices.
What DPI or dimensions should I use and how would I know the way it looks on all devices?
You can just have a drawable folder and use that for any screen size but the image will become distorted as it gets stretched or shrunk down to fit different screen sizes. There are tools out there like https://romannurik.github.io/AndroidAssetStudio/ which will resize the image to mdpi, xdpi etc so it looks nice on any screen size.