Show TOC

Currency ControlLocate this document in the navigation structure

Use the currenncy control to present and enter money amounts and currency information. The currency value control presents the currency with the amount, and a title.

In edit mode the user can:
  • Tap the amount to show the input, where you can enter the amount.
  • Tap the currency to show a value help in a dialog view that contains the default values of all the currencies known by the locale framework.

MAFCurrencyView is a complex control, which means that it builds on top of these simple controls: MAFTextView, MAFEditText, MAFSpinnerButton, MAFFilterDialog, MAFSectionHeader, and MAFListView . It extends the capabilities of these native Android simple UI controls and adds styling capabilities to the Currency UI component.

There are one-line and two-line currency views: oneline edit (input) mode, readonly (display) mode, or twoline edit (input) mode, and readonly (display) mode.

To create and present these views in default SAP style, use:
private MAFCurrencyView oneLineEditView;   
private MAFCurrencyView oneLineReadOnlyView;   

oneLineEditView = new MAFCurrencyView(this, "Currency", true, true,  "");   
oneLineReadOnlyView = new MAFCurrencyView(this, "Currency", false, true, "");       

MAFCurrencyView twoLineEditView = new MAFCurrencyView(this, "Currency", true, 
false, "");   
MAFCurrencyView twoLineReadView =  new  MAFCurrencyView( this,  "Currency",  false,  
false, ""); 

The MAF skinning engine customizes the MAFCurrencyView. To apply SAP style, set the custom style for background, foreground, shadow, font family, and font size in the XML file. Because this complex control consists of six simple controls, you must set all six 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:
You can also inherit the style definition from the standard Currency and create a flavored version. This is an example for a red currency flavor:
<Style TargetType="Label" Key="RedCurrency" BasedOn="DefLabel" platform="android">
<Style TargetType="TextBox" Key="RedCurrency" BasedOn="DefTextBox" 
<Style TargetType="ComboBox" Key="RedCurrency" BasedOn="SpinnerDef" 
</ Style > 
After creating custom styles, you can create flavored Currency input from code:
oneLineEditView = new  MAFCurrencyView(this, "Currency", true, true, "RedCurrency");