Public Sub SetFloatTextField(FloatTextField As B4XFloatTextField)
FloatTextField.SmallLabelTextSize = 14 'Hint Small
FloatTextField.LargeLabelTextSize = 16 'Hint Large
FloatTextField.TextField.TextSize = 16 'Text
Dim TextFontSmall As B4XFont = xui.CreateFont2(FloatTextField.HintFont, FloatTextField.SmallLabelTextSize)
Dim TextWidthSmall As Int = MeasureTextWidth(FloatTextField.HintText, TextFontSmall)
Dim TextFontLarge As B4XFont = xui.CreateFont2(FloatTextField.HintFont, FloatTextField.LargeLabelTextSize)
Dim TextWidthLarge As Int = MeasureTextWidth(FloatTextField.HintText, TextFontLarge)
FloatTextField.HintLabelSmallOffsetY = 5 'Inside
FloatTextField.HintLabelSmallOffsetX = (FloatTextField.TextField.Width - TextWidthSmall) - 5 'Right
FloatTextField.HintLabelLargeOffsetX = (FloatTextField.TextField.Width - TextWidthLarge) - 5 'Right
FloatTextField.Update
If FloatTextField.lblV.IsInitialized Then
FloatTextField.lblV.SetLayoutAnimated(0, 2dip, 0, FloatTextField.lblV.Width, FloatTextField.mBase.Height)
End If
If FloatTextField.lblClear.IsInitialized Then
FloatTextField.lblClear.SetLayoutAnimated(0, FloatTextField.lblV.Width + 4dip, 0, FloatTextField.lblClear.Width, FloatTextField.mBase.Height)
End If
FloatTextField.TextField.As(EditText).Gravity = Bit.Or(Gravity.CENTER_VERTICAL, Gravity.RIGHT)
' Padding
If FloatTextField.Text <> "" Then
FloatTextField.TextField.As(EditText).Padding = Array As Int (60dip, 0dip, 0dip, 0dip)
Else
FloatTextField.TextField.As(EditText).Padding = Array As Int (0dip, 0dip, 0dip, 0dip)
End If
End Sub