B4X Store

B4A tutorial and public API reference

UIIconFont

Built-in icon-font families for controls and labels

Provides Material Design Icons, Font Awesome Regular/Solid, IcoMoon and Bootstrap Icons. Pass a B4XFont to ElevateUI components with icon support. Font assets are provided by the library installation rather than needing manual copies when ElevateUI bundles them.

Animated conceptual preview

UIIconFont in action

Illustrative visualization of the behavior, not an exact Android screenshot. The B4A tutorials below show the implementation.

B4A7 Public SubElevateUI
Search the whole library

1. Step-by-step setup

  1. 1

    Initialize UIIconFont before reading font properties.

  2. 2

    Choose the family matching the glyph's Unicode code point.

  3. 3

    Use the returned font in a label or ElevateUI component.

  4. 4

    Set FontSize to reload all font families at the desired size.

2. Practical recipes

1. Icon using Font Awesome Solid

Sub Globals
    Private IconFonts As UIIconFont
    Private IconLabel As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
    IconFonts.Initialize
    IconFonts.FontSize = 28
    IconLabel.Initialize("")
    IconLabel.Text = Chr(0xf121)
    IconLabel.TextColor = 0xFF8B5CF6
    Activity.AddView(IconLabel, 24dip, 32dip, 80dip, 48dip)
    Dim labelView As B4XView = IconLabel
    labelView.Font = IconFonts.IconFontAwesomeSolid
End Sub

2. Icons on a progress panel

Dim fonts As UIIconFont
fonts.Initialize
Dim p As UIPanelProgressBar
p.Initialize(Me, "Progress")
p.AddToParent(Activity, 20dip, 130dip, 100%x - 40dip, 75dip)
p.setTitle("Programming")
p.setIcon(Chr(0xf121), fonts.IconFontAwesomeSolid)
p.setProgress(85)

3. Designer properties

This class has no custom Designer properties; configure it through its public methods.

4. Every public method explained

7 public method signatures reviewed for this component

Public Sub Initialize

Loads five icon families with initial size 20.

Public Sub getIconMaterialFont As B4XFont

Returns Material Design Icons font.

Public Sub getIconFontAwesomeRegular As B4XFont

Returns Font Awesome Regular (outline icons).

Public Sub getIconFontAwesomeSolid As B4XFont

Returns Font Awesome Solid (solid glyphs).

Public Sub getIconMoonFont As B4XFont

Returns IcoMoon font.

Public Sub getBootstrapFont As B4XFont

Returns Bootstrap Icons font.

Public Sub setFontSize(Size As Double)

Reloads all families with the specified size.

Integration note

Do not invoke DesignerCreateView directly; the Designer calls it. Preserve the exact capitalization of APIs. For paired set/get methods, use B4A property syntax (e.g. obj.Text = "Hello" and Log(obj.Text)).