The MAFSectionHeader control is a section header bar that contains a string label in the center, similar to the default action bar. It can also contain an action, which is aligned to the right of the header. MAF adds styling capabilities to the Header UI component, and provides predefined size variations, such as small and normal. MAF supports skinning of tapped/untapped, and enabled/disabled visual states.
LinearLayout ll = new LinearLayout(this); MAFSectionHeader headerTop = new MAFSectionHeader(this, "Address Input View"); ll.addView(headerTop);
<com.sap.maf.uicontrols.view.MAFSectionHeader android:id="@+id/address_section_header" android:layout_width="fill_parent" android:layout_height="wrap_content" x:text="@string/address_button_header" x:text_alignment="CENTER" />
The MAF skinning engine customizes the headers. To apply SAP style, set the custom style for background, foreground, shadow, font family, and font size in the XML file.
<Style TargetType="ActionBar" Key="DefActionBar" platform="android"> <VisualStates> <VisualState Name="Pressed"> <Setter Property="Background" Value="#fffdb919" /> <!-- background color --> </VisualState> </VisualStates> <Setter Property="Background" Value="#ff000000" /> <!-- background color --> <Setter Property="Bg_Bottom_Shadow" Value="#ff999999" /> <!-- background shadow color --> <Setter Property="Separator" Value="#44ffffff" /> <!-- background separator color --> <Setter Property="Foreground" Value="#88ffffff" /> <!-- text color --> <Setter Property="FontFamily" Value="sans_serif" /> <!-- font type --> <Setter Property="FontSize" Value="22" /> <!-- font size --> </Style>
MAFSectionHeader supports skinning of tapped/untapped, and enabled/disabled visual states.
To set visual states, use the <VisualStates></VisualStates> tag.
<Style TargetType="ActionBar" Key="RedSectionHeader" BasedOn="DefActionBar" platform="android"> <VisualStates> <VisualState Name="Pressed"> <Setter Property="Background" Value="#ffff0000" /> <!-- background color --> </VisualState> </VisualStates> </Style>
header = new MAFSectionHeader(context, title, MAFSectionHeader.TEXT_ALIGNMENT.LEFT, “RedSectionHeader”);
<com.sap.maf.uicontrols.view.MAFSectionHeader android:id="@+id/address_section_header" android:layout_width="fill_parent" android:layout_height="wrap_content" x:text="@string/address_button_header" x:text_alignment="CENTER" x:flavor=”RedSectionHeader” />
Background | Color of the MAFSectionHeader’s background; can also be a freestyle gradient. Colors are defined as RGBA (red, green, blue, alpha). |
Foreground | Control's text color. |
FontFamily | Control's font family. |
BorderBrush | Border attribute of the MAFSectionHeader. |
Shadow | The shadow attributes of the MAFSectionHeader (Bg_Top_Shadow): background top shadow color. |