Creating a multi-pane layout for tablets
By now, you have a fair idea of how fragments work, and we have refactored the existing POIApp
to work with fragments. The following sections will walk you through the key steps required to build the multi-pane layout and make the application compatible with Android tablets.
In Chatper 6, Making App Orientation Aware, we discussed the various configuration qualifiers to be considered while adding alternative layouts in Android. One of the qualifiers is the device's screen size. The Android powered device sizes ranges from small, normal, large, xlarge to layout-xxlarge. Since Android 3.2, Android has recommended that you use the sw<N>dp
configuration qualifier to define an extra large layout for a tablet.
Let's assume that we require at least 600dp
of screen width to build a multi-pane layout for the POIApp
. For this, we need add a new layout-sw600dp
subdirectory under the Resources
directory. The Android runtime will pick the layout placed under...