Public Sub Initialize (Callback As Object, EventName As String)
Prepare the instance before its other methods.
Original catalog note: Initializes the button with the callback and event name
ELEVATEUI · B4A · XUI
Custom animated button supporting solid background colors or a List of colors for gradient rendering.
Effects & interface utilities
Custom animated button supporting solid background colors or a List of colors for gradient rendering.
Animated conceptual demonstration, not an exact Android control screenshot.
Bind a Save or Submit button to validation, processing feedback and final confirmation.
Before integrating, examine its methods, events and Designer options.
Tutorials are based on existing project examples or audited APIs. Check each example’s prerequisites; B4A compilation is not claimed.
Dim btn As UIButton
btn.Initialize(Me, "btn")
Dim colors As List = Array As Int(0xFF6750A4, 0xFF03DAC6)
btn.AddToParent(Activity, 16dip, 24dip, 220dip, 52dip, 1, 16, "Continue", Colors.White, colors, 12)
btn.setGradientDirection(btn.GRADIENT_LEFT_RIGHT)
24 audited signatures
Public Sub Initialize (Callback As Object, EventName As String)
Prepare the instance before its other methods.
Original catalog note: Initializes the button with the callback and event name
Public Sub DesignerCreateView (BASE As Object, Lbl As Label, Props As Map)
Invoked automatically by the B4A Visual Designer; do not call manually.
Original catalog note: Creates the view in the designer
Public Sub AddToParent(Parent As B4XView, l As Int, t As Int, w As Int, h As Int, styleButtom As Int, text_zise As Float, text As String, textcolor As Int, backgroundColorOrColors As Object, corner As Int)
Public API declaration; refer to the library behavior for usage details.
Original catalog note: Single background Object: solid Int or List of Int colors (1..32). Gradient direction set separately.
Public Sub setIcon(icon As String, icon_color As Int, iconTypeface As Typeface)
Update icon at runtime when this setting changes.
Original catalog note: Sets an icon on the button with specified color and typeface
Public Sub SetImage(DirImage As String, FileImage As String)
Use SetImage for its named operation; follow its exact signature.
Original catalog note: Sets an image on the button
Sub setText(text As String)
Update text at runtime when this setting changes.
Original catalog note: Sets the text of the button
Sub getText As String
Read the current text value for validation or UI synchronization.
Original catalog note: Gets the text of the button
Returns: String
Public Sub setTextColor(Color As Int)
Update text color at runtime when this setting changes.
Original catalog note: Sets the text color of the button
Public Sub getTextColor As Int
Read the current text color value for validation or UI synchronization.
Original catalog note: Gets the text color of the button
Returns: Int
Public Sub setTextSize(Size As Int)
Update text size at runtime when this setting changes.
Original catalog note: Sets the text size of the button
Public Sub getTextSize As Int
Read the current text size value for validation or UI synchronization.
Original catalog note: Gets the text size of the button
Returns: Int
Public Sub setCornerRadius(Radius As Int)
Update corner radius at runtime when this setting changes.
Original catalog note: Sets the corner radius of the button
Public Sub getCornerRadius As Int
Read the current corner radius value for validation or UI synchronization.
Original catalog note: Gets the corner radius of the button
Returns: Int
Public Sub setBackgroundColor(Color As Int)
Public API declaration; refer to the library behavior for usage details.
Original catalog note: Verified against supplied 2026-11-28 .b4xlib
Public Sub setBackgroundColors(ColorsList As List)
Public API declaration; refer to the library behavior for usage details.
Original catalog note: Verified against supplied 2026-11-28 .b4xlib
Public Sub getBackgroundColors As Int()
Read the current background colors value for validation or UI synchronization.
Original catalog note: Gets the background colors (gradient) of the button
Returns: Int()
Public Sub setGradientDirection(Direction As String)
Public API declaration; refer to the library behavior for usage details.
Original catalog note: Verified against supplied 2026-11-28 .b4xlib
Public Sub getGradientDirection As String
Public API declaration; refer to the library behavior for usage details.
Original catalog note: Verified against supplied 2026-11-28 .b4xlib
Returns: String
Public Sub setMainTextTypeface(TextTypeface1 As Typeface)
Update main text typeface at runtime when this setting changes.
Original catalog note: Sets the typeface of the main text
Public Sub getMainTextTypeface As Typeface
Read the current main text typeface value for validation or UI synchronization.
Original catalog note: Gets the typeface of the main text
Returns: Typeface
Public Sub Elevation(BtElevation As Float, color As Int)
Use Elevation for its named operation; follow its exact signature.
Original catalog note: Sets the elevation (shadow) of the button
Public Sub SetTextGlow(Radius As Float, GlowColor As Int)
Use SetTextGlow for its named operation; follow its exact signature.
Original catalog note: Applies a glowing shadow/glow effect to the button text and icon
Public Sub setStyleCode(StyleCode As Int)
Get/set runtime button style; 1 filled, 2 outlined.
Original catalog note: Verified in supplied current UIButton.bas
Public Sub getStyleCode As Int
Get/set runtime button style; 1 filled, 2 outlined.
Original catalog note: Verified in supplied current UIButton.bas
Returns: Int
#DesignerProperty: Key: TextColor, DisplayName: Text Color, FieldType: Color, DefaultValue: 0xFFFFFFFF, Description: Text color#DesignerProperty: Key: Selectcolor, DisplayName: ColorEffectSelecting, FieldType: Boolean, DefaultValue: True, Description: Enable/disable color effect when selecting#DesignerProperty: Key: ButtomType, DisplayName: Style, FieldType: String, DefaultValue: 1, List: 1|2, Description: Button style (1 or 2)#DesignerProperty: Key: MainText, DisplayName: Select Text, FieldType: String, DefaultValue: Click me, Description: Text displayed on the button#DesignerProperty: Key: TextSize, DisplayName: Text Size, FieldType: Int, DefaultValue: 12, MinRange: 8, MaxRange: 40, Description: Set the text size#DesignerProperty: Key: cornerradius, DisplayName: Corner Radius, FieldType: Int, DefaultValue: 10, MinRange: 0, MaxRange: 100, Description: Set the corner radius#DesignerProperty: Key: BackgroundColor, DisplayName: Background Color, FieldType: Color, DefaultValue: #FF77777B, Description: Solid background color; set a color list in code for an automatic gradient#DesignerProperty: Key: GradientDirection, DisplayName: Gradient Direction, FieldType: String, DefaultValue: AUTO, List: AUTO|TOP_BOTTOM|TR_BL|RIGHT_LEFT|BR_TL|BOTTOM_TOP|BL_TR|LEFT_RIGHT|TL_BR, Description: AUTO uses the mesh gradient; a direction uses a linear gradientInitialize with Me and the event prefix Demo, then add the following handler to your B4A module. Names and arguments come from the library declaration.
Raised when the user taps the control; use it to trigger a real action.
B4A handler signature with Demo prefix
Private Sub Demo_Click()
Log("Click")
End Sub
Raised when the user taps the control; use it to trigger a real action.
B4A handler signature with Demo prefix
Private Sub Demo_LongClick()
Log("LongClick")
End Sub
For code-created controls use Initialize(Me, "Demo") when that signature exists; for Designer controls set the event name there. Replace Demo with the actual prefix.
Public Const GRADIENT_AUTO As String = "AUTO"Public Const GRADIENT_TOP_BOTTOM As String = "TOP_BOTTOM"Public Const GRADIENT_TR_BL As String = "TR_BL"Public Const GRADIENT_RIGHT_LEFT As String = "RIGHT_LEFT"Public Const GRADIENT_BR_TL As String = "BR_TL"Public Const GRADIENT_BOTTOM_TOP As String = "BOTTOM_TOP"Public Const GRADIENT_BL_TR As String = "BL_TR"Public Const GRADIENT_LEFT_RIGHT As String = "LEFT_RIGHT"Public Const GRADIENT_TL_BR As String = "TL_BR"Public mBase As B4XViewPublic Tag As ObjectPublic ColorEffectSelecting As Boolean = TruePublic Const STYLE_FILLED As Int = 1Public Const STYLE_OUTLINED As Int = 2