The MAFSpinnerButton control extends the capabilities of the android.widget.Button native button. MAF adds styling capabilities to the Button UI component and supports skinning of tapped/untapped, and enabled/disabled visual states.
button = new MAFSpinnerButton(context);
The MAF skinning engine customizes the buttons. To apply SAP style, set the custom style for background, foreground, shadow, font family, and font size in the XML file.
<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.
<VisualState Name="Unfocused_Disabled"> … </VisualState> <VisualState Name="Focused_Disabled"> … </VisualState> <VisualState Name="Focused_Enabled"> … </VisualState> <VisualState Name="Pressed"> … </VisualState>
<Style TargetType="ComboBox" Key="SpinnerButtonRed" 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>
MAFSpinner mafspinner = new MAFSpinnerButton(context,”SpinnerButtonRed”);
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. |