Address Control

Use the address control to present and edit address information. It is implemented as single view that contains many fields. The field layout is determined by the country selected in the address.

In edit mode the user can:
  • Tap the street number or zip code fields to show the numerical keypad.
  • Tap the street name or city name to show an alphanumerical keypad.
  • Tap the country to show a value help in a dialog view that contains the default values of all the countries known by the locale framework.

MAFAddressView

The MAFAddressView control is a complex reusable control, which means that is built on top of the MAFTextView, MAFEditText, MAFSpinnerButton, and MAFFilterDialog simple controls, extends their capabilities, and adds styling capabilities to the Address UI component.

MAFAddressView has two modes: a display (read only) mode, and an editing (input) mode.

To create and present these views in default SAP style, use this code:
private MAFAddressView inputAddressView;
private MAFAddressView displayAddressView;
inputAddressView = new MAFAddressView(this, "ADDRESS", true);
displayAddressView = new MAFAddressView(this, "ADDRESS", false);
To create an MAFAddressView in the Android layout XML in input mode, use:
            <com.sap.maf.localeawarecontrols.MAFAddressView
                android:id="@+id/address_view"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                x:text="@string/address"
                android:visibility="visible" />
You cannot create MAFAddressView in the XML in display mode.

The MAF skinning engine customizes the address. To apply SAP style, set the custom style in the XML file for background, foreground, shadow, font family, and font size. Because this is a complex control which consists of four simple controls, you have to set all four TargetTypes.

See these topics for the XAML contents, for the TargetTypes MAFCurrencyView uses, and for the properties you can set in the skinning XML for MAFCurrencyView: MAFTextView, MAFEditText, MAFSpinnerButton, and MAFFilterDialog.

You can also inherit the style definition from the standard Address and create a flavored version. Here is an example for a red address flavor:
<Style TargetType="Label" Key="RedAddressView" BasedOn="DefLabel" platform="android">
…
</Style>
<Style TargetType="TextBox" Key="RedAddressView" BasedOn="DefTextBox" platform="android">
…
</Style>
<Style TargetType="ComboBox" Key="RedAddressView" BasedOn="SpinnerDef" platform="android">
…
</Style>
After creating the custom styles, you can create a flavored address from code:
inputAddressView = new MAFAddressView(this, "ADDRESS", true, "RedAddressView");