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.
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);
<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.
<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 >
<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 >
<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 >
RadioButton customRB = MAFUIFactory.getInstance().getRadioButton(this,”RedRadioButton”);
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. |