The MAFEditText control extends the capabilities of the android.widget.EditText native button. MAF adds styling capabilities to the EditText UI component. Use MAFEditText for password input fields or mandatory input fields.
MAFEditText customText = new MAFEditText(this);
<com.sap.maf.uicontrols.view.MAFEditText android:layout_width="wrap_content" android:layout_height="40dp" android:hint="@string/hint_edit_text" />
MAFEditText passwordText = MAFUIFactory.getInstance().getPasswordEditText(this, false, true);
MAFEditText customText = MAFUIFactory.getInstance().getMandatoryEditText(this);
MAFMandatoryEditText is an extension of MAFEditText: it adds an indicator that shows that the field requires an entry from the user. Use its API to set an error message that you can present on the screen. The component does not perform any validation; however, it shows an error if the setError API is called.
<Style TargetType="TextBox" Key="DefTextBox" platform="android"> <VisualStates> <VisualState Name="Unfocused_Enabled"> <Setter Property="Background" Value="#ff999999" /> <!-- base line color --> <Setter Property="Foreground" Value="#ff333333" /> <!-- text color --> <Setter Property="DetailsForeground" Value="#ff333333" /> <!-- hint color --> <Setter Property="FontFamily" Value="sans_serif" /> <!-- font type --> <Setter Property="FontSize" Value="14" /> <!-- font size --> </ VisualState >
<Style TargetType="TextBox" Key="DefTextBox" platform="android"> <VisualStates> <VisualState Name="Unfocused_Enabled"> <Setter Property="Background" Value="#ff999999" /> <!-- base line color --> <Setter Property="Foreground" Value="#ff333333" /> <!-- text color --> <Setter Property="DetailsForeground" Value="#ff333333" /> <!-- hint color --> </VisualState> <VisualState Name="Unfocused_Disabled"> … </VisualState> <VisualState Name="Focused_Disabled"> … </VisualState> <VisualState Name="Focused_Enabled"> … </VisualState> <VisualState Name="Pressed"> … </VisualState> </VisualStates> </ Style >
<Style TargetType="TextBox" Key="RedTextBox" BasedOn="DefTextBox" platform="android"> <VisualStates> <VisualState Name="Unfocused_Enabled"> <Setter Property="Background" Value="#0091E0" /> <!-- base line color --> <Setter Property="Foreground" Value="#ff0000" /> <!-- text color --> <Setter Property="DetailsForeground" Value="#F50742" /> <!-- hint color --> </VisualState> </VisualStates> <Setter Property="FontFamily" Value="sans_serif" /> <!-- font type --> <Setter Property="FontSize" Value="14" /> <!-- font size --> </ Style >
MAFEdittext customText = new MAFEditText(this, "RedTextBox");
Background | Base line color |
Foreground | Text color |
FontFamily | Font type |
DetailsForeground | Hint color |
FontSize | Font size |