The MAFCheckBox control extends the capabilities of the android.widget.CheckBox native button. MAF adds styling capabilities to the CheckBox UI component.
// Create a new native CheckBox instance
CheckBox cb0 = new CheckBox(this);
cb0.setChecked(true);
cb0.setText("Enable it.");
// Customize the native CheckBox with the actual skin setting
cb0 = MAFUIFactory.getInstance().customizeCheckBox(cb0);
cb0.setContentDescription("Enable it checkbox");
// Create a new MAF skinnable CheckBox instance using style informations
MAFCheckBox cb3 = MAFUIFactory.getInstance().getCheckBox(this);
cb3.setChecked(true);
cb3.setEnabled(false);
cb3.setText( "On" );
<com.sap.maf.uicontrols.view.MAFCheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="true" android:text="CheckBox" />
The MAF skinning engine customizes the buttons. To apply SAP style, set the custom style in the XML file for background, foreground, shadow, font family, and font size.
<Style TargetType="CheckBox" Key="DefCheckBox" platform="android">
<VisualStates>
<VisualState Name="Checked_Unfocused_Enabled">
<Setter Property="DetailsForeground" Value="#FF0090D5" />
<!-- checked state center color -->
<Setter Property="SolidColorBrush" Value="#FF999999" />
<!-- checked state center border color -->
<Setter Property="Bg_Top_Shadow" Value="#FF0062A9" />
<!-- checkmark lo color -->
</VisualState>
<Setter Property="Foreground" Value="#FF333333" />
<Setter Property="FontFamily" Value="sans_serif" />
< Setter Property="FontSize" Value="14" />
<Style TargetType="CheckBox" Key="DefCheckBox" platform="android">
<VisualStates>
<VisualState Name="Checked_Unfocused_Enabled">
<Setter Property="DetailsForeground" Value="#FF0090D5" />
<!-- checked state center color -->
<Setter Property="SolidColorBrush" Value="#FF999999" />
<!-- checked state center border color -->
<Setter Property="Bg_Top_Shadow" Value="#FF0062A9" />
<!-- checkmark lo color -->
</VisualState>
<VisualState Name="Checked_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>
<VisualState Name="Disabled">
…
</ VisualState >
<Style TargetType="CheckBox" Key="BlueCheckBox" BasedOn="DefCheckBox"
platform="android">
<Setter Property="Foreground" Value="#0000ff" />
<Setter Property="Background" Value="#000099" />
<Setter Property="BorderBrush" Value="#0000ff" />
<Setter Property="FontSize" Value="18" />
</ Style >
MAFCheckBox cb3 = MAFUIFactory.getInstance().getCheckBox( this, "BlueCheckBox" );
| Background | Base line color |
| DetailsForeground | Checked state center color |
| SolidColorBrush | Checked state center border color |
| Bg_Top_Shadow | Checkmark low color |
| BorderBrush | Selection border color |
| Foreground | Font color of the check box's label |
| FontFamily | Font family of the check box's label |
| FontSize | Font size for the text of the check box's label |