Adapting an Android Phone Application to Be Used on a Tablet
In Chapter: Designing a successful Application
Author: Pratik Rupwal ('prupwal')
I have developed an application for my smart phone. Is there a way to run it gracefully on a tablet without any significant changes to my code?
Following a few guidelines for porting a smartphone application to a tablet makes the application appear graceful on tablet.
Assuming that you have android SDK installed on your computer, follow these instructions,
1. Launch the Android SDK and AVD Manager and install the following:
a. SDK Platform Android 3.0
b. Android SDK Tools, revision 10
c. Android SDK Platform-tools, revision 3
d. Documentation for Android SDK, API 11
e. Samples for SDK API 11
2. Create an AVD for a tablet-type device, if you do not have an actual device yet. Set the target to "Android 3.0" and the skin to "WXGA" (the default skin).
3. Open your manifest file and update the uses-sdk element to set android:targetSdkVersion to "11". For example:
<manifest ... >
<application ... >
By targeting the Android 3.0 platform, the system automatically applies the holographic theme to each activity when your application runs on an Android 3.0 device. The holographic theme provides a new design for widgets, such as buttons and text boxes, and new styles for other visual elements. This is the standard theme for applications built for Android 3.0, so your application will look and feel consistent with the system and other applications when it is enabled.
4. Build your application against the same version of the Android platform you have been using previously (such as the version declared in your android:minSdkVersion), but install it on the Android 3.0 AVD. (You should not build against Android 3.0 unless you are using new APIs.) Repeat your tests to be sure that your user interface works well with the holographic theme.
1. Landscape layout: The "normal" orientation for tablet-type devices is usually landscape (wide), so you should be sure that your activities offer a layout that's optimized for a wide viewing area.
2. Button position and size: Consider whether the position and size of the most common buttons in your UI make them easily accessible while holding a tablet with two hands. In some cases, you might need to resize buttons, especially if they use "wrap_content" as the width value. To enlarge the buttons, if necessary, you should either: add extra padding to the button; specify dimension values with dp units; or use android:layout_weight when the button is in a linear layout. Use your best judgment of proportions for each screen size-you don't want the buttons to be too big, either.
3. Font sizes: Be sure your application uses sp units when setting font sizes. This alone should ensure a readable experience on tablet-style devices, because it is a scale-independent pixel unit, which will resize as appropriate for the current screen configuration. In some cases, however, you still might want to consider larger font sizes for extra-large configurations.