Specifying Supported Screen Sizes

For some applications it may not be possible to optimize your UI to support all possible screen sizes. You can use the <supports-screens> manifest element to specify which screens your application can be run on, as shown in Listing 4-25.

LISTING 4-25: Manifest element supporting normal and large screen sizes Available for download on <supports-screens Wrox.com android:smallScreens="false"

android:normalScreens="true" android:largeScreens="true" android:anyDensity="true"

In this context a small screen is any display with resolution smaller than HVGA. A large screen is significantly larger than a smartphone (such as a tablet), while normal screens encompass the majority of smartphone handsets.

The anyDensity attribute controls how your application will be scaled when displayed on devices of varying pixel density. If you have taken varying pixel density into account in your UI (and you should have) set this to true.

A false value will force Android to use compatibility scaling to attempt to scale your application UI correctly. This will generally result in a UI with degraded image assets that show scaling artifacts.

Applications built with an SDK of API level 4 or higher will default all of these values to true.

Mobile Apps Made Easy

Mobile Apps Made Easy

Quick start guide to skyrocket your offline and online business success with mobile apps. If you know anything about mobile devices, you’ve probably heard that famous phrase coined by one of the mobile device’s most prolific creators proclaiming that there’s an app for pretty much everything.

Get My Free Training Guide

Post a comment