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
Al Lu
UX Design Techdegree Student 15,892 PointsDesigning for Android course?
Hey. I know that designing for Android can be confusing becuse we need to create images in different resolutions (for each image). So I think that will be great if Treehouse will put a new course about the topic. Also designing for Android is something very common to see on jobs boards so Its very useful skill. Thanks. Allen.
2 Answers
Ben Jakuben
Treehouse TeacherFeedback noted! We will touch on design for Android in the upcoming Ribbit app, much like we did for iOS. It's from more of a developer perspective, but we would definitely like to add Android and iOS design as soon as we can.
As for images, I wrote up an answer on StackOverflow a while back that gives a good starting point:
Images and other visual files are stored in one or more drawable directories. If only in one directory, Android will scale the image as needed. If more than one directory is used, Android will select the appropriately sized image.
- drawable-ldpi - Low density images
- drawable-mdpi - Medium density images
- drawable-hdpi - High density images
- drawable-xhdpi - Extra high density images (i.e. retina-like displays)
- drawable-xxhdpi - Extra extra high density images (newest devices like Nexus 10, Samsung Galaxy S4, HTC One and Sony Xperia Z)
(Side note: XML files can also be written and stored as drawables. These kinds of files can control when multiple images are to be used based on the state of a view, or other visual settings like gradients, borders, etc.)
So, what should you do?
For best results (from the Android developer docs):
To generate these images, you should start with your raw resource in vector format and generate the images for each density using the following size scale:
- xxhdpi: 3.0
- xhdpi: 2.0
- hdpi: 1.5
- tvdpi: 1.33 (TVs only)
- mdpi: 1.0 (baseline)
- ldpi: 0.75
This means that if you generate a 200x200 image for xhdpi devices, you should generate the same resource in 150x150 for hdpi, 133x133 for tvdpi, 100x100 for mdpi, and finally a 75x75 image for ldpi devices.
If you just want to use one image and let Android scale for you:
More than 75% of Android devices now have either hdpi or xhdpi resolutions, according to the Dashboard on the Android Developer site. So if you create one image of hdpi, for example, it will look perfect on 50% of devices, scale up a bit to 25%, and scale down to 25%. In general I think you'd be better off scaling down than scaling up, too.
Al Lu
UX Design Techdegree Student 15,892 PointsThanks Ben this is very helpful!