Home > Articles > Programming > Java

  • Print
  • + Share This
From the author of

Managing Your Resources

Tablet development concerns reside mostly in the realm of the graphic artist or screen designer, rather than the Android Java developer. But much can be achieved through the prudent use of alternative project resources.

The Android SDK allows you to supply project resources such as graphics and layout designs for various target device characteristics (for example, screen size and resolution). To achieve this goal, place the resources in the appropriate directories, using a vast array of directory name qualifiers. Some of these qualifiers are useful for localization, but many others can be used to target user interfaces for screen size, resolution, orientation, and other device features. Used well, each class of device can have its own distinct look and feel, while the underlying code remains unchanged. For more information, see the discussion "Providing Alternative Resources" in the Android SDK documentation.

Using Space Effectively on Large Landscape Screens

Tablets are not smartphones. Most tablets have screens measuring seven inches or larger diagonally. However, a few tablets have screens that are around the five-inch mark. In terms of resources, tablets are usually defined as having "large" or "extra large" screens. A "large" screen is defined as being 5–7 inches, and "extra large" screens are 7–10 inches. The overlap in the definition means that the device's description depends on the manufacturer. Since a normal-sized screen could be larger than five inches, relying exclusively on terms such as "large" and "extra large" to identify tablets isn't exactly foolproof. However, a device listed as "normal" size that's five inches long may be just a really large smartphone. When using the resource qualifier, you're looking at the large and xlarge values. Although xlarge was introduced at API Level 9 (Android 2.3), it will be ignored on earlier devices.

Tablets are most frequently held and used in landscape mode. Although supporting both orientations is ideal, if you're going to support only one orientation for a tablet, we recommend using landscape mode. Consider the Motorola XOOM dock, which is landscape only. However, on a tablet—much more than on other devices—the landscape layout may be different from the portrait layout. Consider establishing different layouts by using the port and land qualifiers.

Just scaling up the graphics for big screens often isn't enough. Consider a smartphone layout that has four buttons across, sized so that even large fingers will have no trouble tapping them. Then enlarge that layout proportionately to a 10-inch tablet screen, which might be over 8 inches wide—now you have buttons on the order of 2 inches wide! That might work for a toddler-friendly interface, but most adults will see those big buttons as a waste of space. Reduce the size of the buttons and find some other useful feature to put into that newly gained space.

  • + Share This
  • 🔖 Save To Your Account