B4A Library [B4X] BBScrollingLabel - rich text scrolling label

F0DYcnZwgV.gif

(this is an animated gif, it is is much smoother in real usage)

BBScrollingLabel is similar to XUI Views ScrollingLabel, however it is based on BCTextEngine and can therefore display formatted text.

It is cross platform.

Usage instructions:
- Download the b4xlib and put it in the B4X additional library folder: https://www.b4x.com/android/forum/threads/103165/#content
- Add reference to BBScrollingLabel and BCTextEngine : https://www.b4x.com/android/forum/t...-bbcode-parser-rich-text-view.106207/#content
- Add BBScrollingLabel with the designer.

Code:
B4X:
Sub Globals
    Private BBScrollingLabel1 As BBScrollingLabel
    Private TextEngine As BCTextEngine
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("1")
    TextEngine.Initialize(Activity) 'change to Form.RootPane in B4J or Page.RootPanel in B4i
    BBScrollingLabel1.TextEngine = TextEngine
    BBScrollingLabel1.Text = $"[b][u]BBScrollingLabel[/u][/b]: [color=red]Red[/color] [color=0xFF08B31F]Green[/color] [color=blue]Blue[/color]. More information: [url]https://www.b4x.com[/url]..............."$
End Sub

Sub Activity_Resume
    'this is required in B4A only (when not using B4XPages). It resumes the animation after the activity was paused.
    BBScrollingLabel1.Text = BBScrollingLabel1.Text
End Sub

Updates

v1.02 - Fixes an issue in B4i where the label is resized before it is ready.
v1.01 - Fixes crash when text is empty.
- New MaxWidth designer property. Sets the maximum width of the full text.
 

Attachments

  • ScrollingLabel Example.zip
    11.5 KB · Views: 633
  • BBScrollingLabel.b4xlib
    5.2 KB · Views: 459
Last edited:
Top