Xamarin – walk-through – (Part 3)

Declaring the screen size ensures that only supported devices can download the application. This is accomplished by setting the <supports-screens> element in the AndroidManifest.xml file. This element is used to specify what screen sizes are supported by the application. A given screen is considered to be supported if the application can properly it’s layouts to fill screen. By using this manifest element, the application will not show up in Google Play for devices that do not meet the screen specifications. However, the application will still run on devices with unsupported screens, but the layouts may appear blurry and pixelated.

Multiple Screen Support

It is strongly recommended that applications that are meant to run on Android 3.2 or higher should be using these newer qualifiers.

For example, if a layout required a minimum 700dp of screen width, the alternate layout would go in a folder layout-sw700dp:

For applications that will span the old and the new API levels, it may be necessary to create alternate resources using both sets of qualifiers as shown in the following screen shot:

The creation of these bitmaps of various densities can be a bit tedious. As such, Google has created an online utility which can reduce some of the tedium involved with the creation of these bitmaps call the Android Asset Studio.

Use DPs rather than Pixels – Pixels become troublesome as screen density changes. Do not hardcode pixel values. Avoid pixels in favor of dp (density-independent pixels).

Avoid AbsoluteLayout Wherever Possible – it is deprecated in API level 3 (Android 1.5) and will result in brittle layouts. It should not be used. Instead, try to use more flexible layout widgets such as LinearLayout, RelativeLayout, or the new GridLayout.

Density-independent units are best reserved for when specifying the margins and padding of UI elements.

Android Design Working with Density Independent Pixels in Photoshop

Application Localization and String Resources

Localization in Android

Localization – values Folder For Multilingual App

Assets are read using an AssetManager. An instance of the AssetManager is available by access the Assets property on an Android.App.Context, such as an Activity.

Leave a Reply

Your email address will not be published. Required fields are marked *