3 ms·
There's a lot of shortcuts in this article. I appreciate him taking the time to put it together but a lot of important Android design practices were overlooked
by radley 14y ago
There's a lot of shortcuts in this article. I appreciate him taking the time to put it together but a lot of important Android design practices were overlooked or misquoted.
There's 6 resolutions: ldpi, mdpi, tvdpi, hdpi, xhdpi, & xxhdpi. Of these, ldpi is often skipped, and tvdpi is optional (the Nexus 7 and Google TV use it). The new one, xxhdpi is important for new 1080p phones like the Droid DNA and upcoming Galaxy S4.
Resolutions are multiples. It's easiest to remember them as 48, 64, 72, 96, 144 (these are the sizes of your app icon). xhdpi is 2x mdpi. hdpi is 1.5x mdpi. tvdpi is 2/3 of xhdpi. xxhdpi is 3x mdpi & 1.5x xhdpi.
It's not pixels, it's usually dp (density-independent pixels) which are based on mdpi. As such, it's a good idea to design layouts at mdpi scale - it just makes it easier to match your dp values. I lay out for 320x480 and 1280x720.
I wrote a detailed blog post on 9-scale (http://radleymarx.com http://radleymarx.com).
For most Nexus devices, the Action Bar is the only access to the Overflow Menu (aka the old Options Menu). So although it's only "recommend" to use it, there's no way to use the menu without it.
Fonts can be specified in the layout XML. You just need a custom TextView class. Note: widgets won't let you use custom class layouts. Fonts are added in the assets folder of the project. Some devices are picky about how you name fonts so it's best to name them as lowercase-name.TTF (uppercase file type).
Most often you'll want to match font sizes that other apps use. The minimum font size you can clearly get away with is 10sp on phones & 11sp on tablets. Users can change text scaling in their device so you should use sp instead of dp for text. If you don't want it to scale (i.e. a decorative layout) you can use dp instead.
The best way to design for devices is to buy one of each screen type. Some groups start a pool of devices to share for testing. For widgets I design for GS3 & GNexus simultaneously, along with a Nexus 7. When the layouts are complete, I start checking on other devices.
- justjohn 14y agoOne other thing I would add is to check on different variations of Android (stock, HTC's Sense, Samsung's TouchWiz, etc..) as well as resolutions, since they have different default widget styles and colors that can affect your app in different ways. (Android 4 is much better about this with Holo, but anything before it can vary a lot.)
- radley 14y agoIf you stick with native styles for device elements (such as the action bar & notifications) that should cover 99% of requirements. Widgets are a different matter. Suffice to say the big difference there is between Samsung/HTC who displays full-sized widgets and Nexus/Motorola/Asus who force widgets to use way too much padding.
- radley 14y agoI should also add: use Illustrator for layouts, not Photoshop, to take advantage of scalable vector art. Sooooo much easier.
- jakelazaroff 14y agoYou should always tweak your graphics by hand afterward, though! Don't trust Illustrator to scale them nicely for you. See http://dcurt.is/pixel-fitting http://dcurt.is/pixel-fitting
- radley 14y agoThat stuff doesn't matter so much these days. With old 72dpi bad pixels were really obvious. But at 280+ it's really hard to see them. I'd rather spend my time fixing Android XML layout weaknesses...