4 MINUTE READ | October 26, 2011
iPhone Developers, Meet Android – Part IV : Make it look good.
I know, this was a piece of cake on the iPhone, Apple already did more than half of it for you. All you had to do was change a few colors, slap a couple background images on there, make a shiny, little, rounded-cornered, icon, and BAM it looks fantastic. Now, here you stand, before the towering atrocity that is Android. But, it’s not so bad once you get to know it. It’s actually a bit similar to developing for web when it comes to UI, just without the browser difference issues.
Look at your app on as many devices as you can get your hands on. I’m sure you’ve heard this one said at least a dozen times already but it’s very important, especially for an iPhone developer. With iOS development you have a maximum of three different sizes, the standard iPhone, iPhone retina display, or the iPad (if you want to support it). With Android, there are well over one hundred different devices made that run on the Android OS, very few of them having the same screen size. So, it’s very important that you do everything you can to make sure that your application looks fantastic on as many of those devices as you possibly can. So, here are a few things to keep in mind when designing or building the interface for your Android application:
I’ll be the first to admit it, when it comes to actually trying to test and develop an application, the AVD sucks. But, the one fantastic thing you can do with it is set it up to emulate any device specifics you want it to. Utilizing this you can effectively view your application on every single screen size/density combination you can possibly think of! Without having to go out and buy twenty to thirty different devices, just to make sure your application doesn’t turn out looking a mess on any potential user’s device.
Again, this is something you’ve probably been told already, but in Android you have a directory titled ‘drawables’ located in the ‘res’ directory, this is where you keep all of your graphics that you’re going to be using in your application. A great thing that they’ve done though is created a set of delimiters you can use to separate your graphics into three different directories, ‘drawables-hdpi’, ‘drawables-mdpi’, and ‘drawables-ldpi’. One of these three directories is downloaded from the Marketplace with your app based on the device downloading the app. Using these is essential for making sure that your app looks great across all devices. Also, when using these, make sure you have this snippet of code in your AndroidManifest.xml:
<supports-screens android:anyDensity=_"true"_ />
Also, if you want to support Android tablet devices you can make use of a fourth delimiter, ‘-xhdpi’, to ensure all of your drawables display properly on a tablet.
Due to the fact that, though becoming increasingly more rare, there are still devices that feature a slide out keyboard, you have to support landscape orientation across your entire application, unless you want to just exclude these users entirely. To do this all you need do is create a second ‘layouts’ directory titled ‘layouts-land’ and recreate any of your layouts that need to be re-done to fit a landscape orientation in that directory.
Also, in this same way, by adding ‘-ldpi’, ‘-mdpi’, ‘-hdpi’, or ‘-xhdpi’ to the end of the directory name, you can rearrange your layouts to ensure that all of the UI elements fit properly on all screen sizes. Alternatively, you can use the screen size instead of the density by using ‘-small’, ‘-medium’, ‘-large’, or even ‘-xlarge’ (You can do this for the Drawables as well).
You can go to the developer website to read up on the proper use of the different delimiters.
These are a fantastic invention. I’m going to be completely frank and just say this is my favorite thing about Android development. Bar none. You know what, I think I’ll save Nine Patches for the next part, so that I can go a bit more in depth.
Sign up for weekly articles & resources.
Just remember, you want it to look good. I know, I know, I miss XCode too. I’m terribly sick of fighting with Eclipse, but that’s not any kind of reason to leave all the poor young men with their fancy new smartphones out in the dark. I agree, they should’ve bought an iPhone. But, does that really give you the right to give them crap? No. So, make it look good. In the end it only makes you look better.
Posted by PMG Advertising Agency
4 MINUTES READ | November 2, 2021
2 MINUTES READ | February 4, 2020
11 MINUTES READ | October 21, 2019
4 MINUTES READ | September 21, 2019
8 MINUTES READ | September 3, 2019
5 MINUTES READ | August 22, 2019
3 MINUTES READ | June 6, 2019
13 MINUTES READ | March 12, 2019
4 MINUTES READ | March 6, 2019
4 MINUTES READ | December 20, 2018