The MAFProgressBar control extends the capabilities of the android.widget.ProgressBar native component. MAF adds styling capabilities to the ProgressBar UI component, and provides predefined size variations, such as small and normal.
ProgressBar pb = MAFUIFactory.getInstance().getProgressBar(this, android.R.attr.progressBarStyleHorizontal); pb.setSecondaryProgress(40); pb.setProgress(10);
<com.sap.maf.uicontrols.view.MAFProgressBar android:id="@+id/MAFProgressBar" android:layout_width="wrap_content" android:layout_height="50dip"/>
The MAF skinning engine customizes the ProgressBar. To apply SAP style, set the custom style for background, foreground, and solid color brush in the XML file.
<Style TargetType="ProgressBar" Key="DefProgressBar" platform="android"> <Setter Property="Background" Value="#80DDDDDD" /> <!-- background color --> <Setter Property="Foreground" Value="#ff0062a9" /> <!-- progress color --> <Setter Property="SolidColorBrush" Value="#8000a3d7" /> <!-- secondary progress color --> </ Style >
<Style TargetType="ProgressBar" Key="RedProgressBar" BasedOn="DefProgressBar" platform="android"> <Setter Property="Background" Value="#000099" /> <!-- background color --> <Setter Property="Foreground" Value="#ff0000" /> <!-- progress color --> <Setter Property="SolidColorBrush" Value="#003333" /> <!-- secondary progress color --> </ Style >
MAFProgressBar pb = new MAFProgressBar(context, android.R.attr.progressBarStyle, "RedProgressBar”);
Background | Color of the MAFProgressBar’s background; Colors are defined as RGBA (red, green, blue, alpha). |
Foreground | Control's progress color. |
SolidColorBrush | Control's secondary progress color. |