MAFSpinner

MAFSpinner extends the capabilities of the android.widget.Spinner native spinner. MAF adds styling capabilities to the Spinner UI component, and provides predefined size variations, such as small and normal. MAF supports skinning of tapped/untapped, and enabled/disabled visual states.

To create and present a default SAP style instance of MAFSpinner, use:
LinearLayout row1 = new LinearLayout(this);
MAFSpinner mss = new MAFSpinner(this);
		ArrayAdapter<CharSequence> a = ArrayAdapter.createFromResource(this, R.array.Days123,
				android.R.layout.simple_spinner_item);
		// Specify the layout to use when the list of choices appears
		a.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		mss.setAdapter(a);
To create an MAFSpinner in the Android layout XML, use:
    <com.sap.maf.uicontrols.view.MAFSpinner
        android:id="@+id/MAFSpinner"
        android:layout_width="wrap_content"
        android:layout_height="50dip"
        android:text="skinned spinner" />

The MAF skinning engine customizes the spinners. To apply SAP style, set the custom style for background, foreground, shadow, font family, and font size in the XML file.

This is the XAML content for the default style of the Spinner TargetType:
	<Style TargetType="ComboBox" Key="SpinnerDef" platform="android">
		<VisualStates>
			<VisualState Name="Unfocused_Enabled">
				<Setter Property="Background" Value="#ff999999" />
				<!-- base line color -->
				<Setter Property="SolidColorBrush" Value="#ff666666" />
				<!-- triangle color -->
				<Setter Property="Foreground" Value="#ff333333" />
				<!-- text color -->
			</VisualState>
MAF supports skinning of tapped/untapped, and enabled/disabled visual states. To set visual states, use the <VisualStates></VisualStates> tag:
			<VisualState Name="Unfocused_Disabled">
…
			</VisualState>
			<VisualState Name="Focused_Disabled">
				…
			</VisualState>
			<VisualState Name="Focused_Enabled">
				…
			</VisualState>
			<VisualState Name="Pressed">
				…
			</VisualState>
You can also inherit the style definition from the standard spinner and create a flavored spinner. This is an example for a red styled spinner flavor:
	<Style TargetType="ComboBox" Key="SpinnerRed" BasedOn="SpinnerDef" platform="android">
		<VisualStates>
			<VisualState Name="Unfocused_Enabled">
				<Setter Property="Background" Value="#B60000" />
				<!-- base line color -->
				<Setter Property="SolidColorBrush" Value="#0abb00" />
				<!-- triangle color -->
			</VisualState>
			<VisualState Name="Unfocused_Disabled">
				<Setter Property="Background" Value="#B60000" />
				<!-- base line color -->
				<Setter Property="SolidColorBrush" Value="#0abb00" />
				<!-- triangle color -->
			</VisualState>
			<VisualState Name="Focused_Disabled">
				<Setter Property="Background" Value="#B00400" />
				<!-- base line color -->
				<Setter Property="SolidColorBrush" Value="#0abb00" />
				<!-- triangle color -->
				<Setter Property="BorderBrush" Value="#00F300" />
				<!-- selection border color -->
			</VisualState>
			<VisualState Name="Focused_Enabled">
				<Setter Property="Background" Value="#0AC200" />
				<!-- base line color -->
				<Setter Property="SolidColorBrush" Value="#aabb00" />
				<!-- triangle color -->
				<Setter Property="BorderBrush" Value="#FAF300" />
				<!-- selection border color -->
			</VisualState>
			<VisualState Name="Pressed">
				<Setter Property="Background" Value="#D00400" />
				<!-- base line color -->
				<Setter Property="SolidColorBrush" Value="#a0bb00" />
				<!-- triangle color -->
				<Setter Property="BorderBrush" Value="#0AF300" />
				<!-- selection border color -->
			</VisualState>
		</VisualStates>
	</Style>
To create an MAFSpinner from code, use:
MAFSpinner mafspinner = new MAFSpinner(context,”SpinnerRed”);
You can change these properties in the skinning XML:
Background Color of the MAFSpinner’s background; can also be a freestyle gradient. Colors are defined as RGBA (red, green, blue, alpha).
Foreground Control's text color.
SolidColorBrush Control's triangle color.
BorderBrush Border attribute of the MAFSpinner.