Android scaling – quick example

by: Jason

This morning I wanted to demo how android sizes text for our designer. So I wrote a quick app that displayed text sizes in a few ranges 10-20 sp , dp, and pt. A nice side effect was it also showed how well android handles the vast differences in screen sizes and densities out there.

Some quick photos showing how android handles displaying things at a particular size across screens of different densities. Here’s a galaxy nexus with a 1280×720 (~316 ppi) xhdpi screen and a galaxy s+ with a 800×480 (~233 ppi) hdpi screen both displaying the same app.

The text blocks are all 48dp high, also the suggested sweet-spot for hitbox heights. They are demoing different text sizes that one might set in both sp and dp measurements. (sp will grow if someone turns on large text in the system settings, dp won’t). These screens are very different in terms of pixel counts and physical sizes, yet android performs very well in making them almost physically identical to my eyes and fingers. The nexus screen does look better of course.

The later images shows the difference in using px or dp dimensions for a views width. There’s a noticeable difference setting a px width between devices. Hopefully few people are laying out stuff with px anyway. The docs and the tools point it out straight away as a ‘don’t do that’ moment.

However dp performs nicely and just like the heights, the blocks with a dp width are pretty much physically identical on both.

Android does get a bit of a bashing about the diversity of devices that exist, but the sdk does a very good job in trying to help the developer out as much as possible.

You May Also Like

We built a product in a lockdown

At the start of the lockdown, around March last year, I have to admit a case of the jitters. I was prospecting on five different projects. Some with existing clients, some with new clients. Our order book was good - but we always have to have an eye on up coming...

read more
The Rise of the Super App

The Rise of the Super App

Imagine being able to chat with your friend through instant messaging, then book dinner, a movie or a gig and pay for everything all from one single app. That’s the power of a super app.  Mobile users worldwide have dedicated apps for specific tasks. This is not...

read more

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *