Developer

MAFRadioButton

MAFRadioButton  extends the capabilities of the android.widget. RadioButton native button. MAF adds styling capabilities to the Button UI component, and provides predefined size variations, such as small and normal. MAF supports skinning of selected/unselected and enabled/disabled visual states.

To create and present a default SAP style instance of MAFRadioButton, use:
          LinearLayout rowRB = new LinearLayout(this);

          RadioButton customRB = 
MAFUIFactory.getInstance().getRadioButton(this);                
          customRB.setContentDescription("Hello choice radio button");                
          customRB.setText("Hello");                
          customRB.setSingleLine();                
          rowRB.addView(customRB); 
To create MAFRadioButton in the Android layout XML, use:
    <com.sap.maf.uicontrols.view.MAFRadioButton
           android:id="@+id/MAFRadioButton"
           android:layout_width="wrap_content"
           android:layout_height="50dip"
           android:text="skinned button" /> 

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.

This is the XAML content for the default style of the Button TargetType:
       <Style TargetType="RadioButton" Key="DefRadioButton" platform="android">
                 <VisualStates>                       
                       <VisualState Name="Checked_Unfocused_Enabled">                             
                             <Setter Property="Background" Value="#ff999999" />                             
                             <!-- base line color -->                             
                             <Setter Property="BorderBrush" Value="0" />                             
                             <!-- selection border color -->                             
                             <Setter Property="DetailsForeground" Value="#ff0062a9" />                             
                             <!-- checked state center color -->                             
                             <Setter Property="SolidColorBrush" Value="#8000a3d7" />                             
                             <!-- checked state center border color -->                             
                             <Setter Property="Bg_Top_Shadow" Value="#ff00a3d7" />                             
                             <!-- background top shadow color -->
                         </ VisualState > 
MAF supports skinning of selected/unselected and enabled/disabled visual states. To set visual states, use the <VisualStates></VisualStates> tag:
<VisualState Name="Checked_Unfocused_Enabled">                             
        <Setter Property="Background" Value="#ff999999" />                             
        <!-- base line color -->                             
        <Setter Property="BorderBrush" Value="0" />                             
        <!-- selection border color -->                             
        <Setter Property="DetailsForeground" Value="#ff0062a9" />                             
        <!-- checked state center color -->                             
        <Setter Property="SolidColorBrush" Value="#8000a3d7" />                             
        <!-- checked state center border color -->                             
        <Setter Property="Bg_Top_Shadow" Value="#ff00a3d7" />                             
        <!-- background top shadow color -->                       
</VisualState>                       
<VisualState Name="Unchecked_Unfocused_Enabled">                             
        …                       
</VisualState>                       
<VisualState Name="Checked_Unfocused_Disabled">                             
        …                       
</VisualState>                       
<VisualState Name="Unchecked_Unfocused_Disabled">
        …                       
</VisualState>                       
<VisualState Name="Checked_Focused_Disabled">                             
        …                       
</VisualState>                       
<VisualState Name="Unchecked_Focused_Disabled">                             
        …                       
</VisualState>                       
<VisualState Name="Checked_Focused_Enabled">                             
        …                       
</VisualState>                       
<VisualState Name="Unchecked_Focused_Enabled">                             
        …                       
</VisualState>                       
<VisualState Name="Checked_Pressed">                             
        …                       
</VisualState>                       
<VisualState Name="Unchecked_Pressed">                             
        …                         
</ VisualState > 
You can also inherit the style definition from the standard button and create a flavored button. This is an example for a red styled button flavor:
       <Style TargetType="RadioButton" Key="RedRadioButton" 
BasedOn="DefRadioButton" platform="android">
                 <VisualStates>                       
                       <VisualState Name="Checked_Unfocused_Enabled">                             
                             <Setter Property="Background" Value="#00ff00" />                             
                             <!-- base line color -->                             
                             <Setter Property="DetailsForeground" Value="#ff0000" />                             
                             <!-- checked state center color -->                             
                             <Setter Property="BorderBrush" Value="#0000ff" />                             
                             <!-- selection border color -->                             
                             <Setter Property="SolidColorBrush" Value="#00bbcc" />                             
                             <!-- checked state center border color -->                       
                       </VisualState>
                 </VisualStates>
                 <Setter Property="Foreground" Value="#ddff0000" />
                 <Setter Property="FontFamily" Value="monospace" />
                 <Setter Property="FontSize" Value="18" />
           </ Style > 
To create MAFRadioButton from code, use:
RadioButton customRB = MAFUIFactory.getInstance().getRadioButton(this,”RedRadioButton”);
You can change these properties in the skinning XML:
Background Color of the MAFRadioButton’s background base line
Foreground Control's text color
FontFamily Control's font family
FontSize Control's font size
BorderBrush Border attribute of the MAFRadioButton
Shadow The shadow attributes of the MAFRadioButton (Bg_Top_Shadow): background top shadow color.