All Screens Great and Small

Supporting different screen sizes, resolutions, and pixel densities is important because you want your application to look its best on as many Android devices as possible. Android will try to scale your user interface to fit the device, but it doesn’t always do a great job of it. The only way to tell is through, you guessed it, testing. Use the emulator types recommended in Gentlemen, Start Your Emulators to make sure your program works on the most common sizes.

As a test, try running the Tic-Tac-Toe program in the Nexus 9 emulator. You’ll find that the menu on the main activity and the board in the game activity look too small. That’s because all the sizes are specified in dps, but the tablet has a much larger ...

Get Hello, Android, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.