MAFOptionMenu

The MAFOptionMenu control extends the capabilities of the optionmenu native Android control. MAF adds styling capabilities to the Optionmenu UI component. MAF supports skinning of tapped/untapped, and enabled/disabled visual states.

To create and present a default SAP style instance of MAFOptionMenu, use:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();                
        inflater.inflate(R.menu.default_menu, menu);
        // Customize existing option menu. Must be called in 
onCreateOptionsMenu
        // method.                
        MAFUIFactory.getInstance().customizeOptionMenu(this, getResources());
        return true;
} 

The MAF skinning engine customizes the optionmenus. To apply SAP style, set the custom style for background and foreground in the XML file.

This is the XAML content for the default style of the Optionmenu TargetType:
<Style TargetType="OptionMenu" platform="android">
         <VisualStates>                       
                <VisualState Name="Unfocused_Enabled">                             
                       <Setter Property="Background" Value="#ff1b1b1b" />                             
                       <!-- background color -->                       
                 </VisualState>
          <Setter Property="Foreground" Value="#ffa5a5a5" />
          <!-- text color -->
</ Style > 
MAFOptionMenu supports skinning of tapped/untapped, and enabled/disabled visual states. To set visual states, use the <VisualStates></VisualStates> tag:
<VisualState Name="Unfocused_Disabled">                             
       <Setter Property="Background" Value="fff0f0f0" />                             
       <!-- background color -->                       
</VisualState>                       
<VisualState Name="Focused_Disabled">                             
       <Setter Property="Background" Value="#fff0f0f0" />                             
       <!-- background color -->                       
</VisualState>                       
<VisualState Name="Focused_Enabled">                             
       <Setter Property="Background" Value="#ffb2e3f3" />                             
       <!-- background color -->                       
</VisualState>                       
<VisualState Name="Pressed">                             
       <Setter Property="Background" Value="#ff0062a9" />                             
       <!-- background color -->                         
</ VisualState > 
You can change these properties in the skinning XML:
Background Color of the MAFOptionMenu’s background; can also be a freestyle gradient. Colors are defined as RGBA (red, green, blue, alpha).
Foreground Control's text color.