B4A Library TickerView

A wrapper for this GitHub library https://github.com/robinhood/ticker



An Android text view with scrolling text change animation

ticker_main.gif



tickerview
Author:
SMM
Version: 0.01
  • TickerView
    Events:
    • click
    Fields:
    • ba As BA
    Methods:
    • BringToFront
    • EMPTY_CHAR As Char
    • Initialize (EventName As String)
    • Invalidate
    • Invalidate2 (arg0 As Rect)
    • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • IsInitialized As Boolean
    • RemoveView
    • RequestFocus As Boolean
    • SendToBack
    • SetBackgroundImage (arg0 As Bitmap)
    • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
    • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
    • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    Properties:
    • AnimationDuration As Int [write only]
    • Background As Drawable
    • CharacterList() As Char [write only]
    • Color As Int [write only]
    • Enabled As Boolean
    • Height As Int
    • Left As Int
    • Parent As Object [read only]
    • Tag As Object
    • Text As String [write only]
    • TextColor As Int [write only]
    • TextSize As Int [write only]
    • Top As Int
    • Typeface As Typeface [write only]
    • Visible As Boolean
    • Width As Int


Example

Please note that EMPTY_CHAR field should be inserted at the first index of character list as shown in example , The app crashed before inserting it in the array .

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim time As Timer
    time.Initialize("time",1000)
    time.Enabled=True
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim tv As TickerView
End Sub
Sub time_Tick
    tv.Text=DateTime.Now

End Sub
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
'    Activity.LoadLayout("Layout1")
    tv.Initialize("")
    Activity.AddView(tv,0,0,50%x,50%y)

    tv.CharacterList=Array As Char(tv.EMPTY_CHAR,0,1,2,3,4,5,6,7,8,9)

End Sub

version 0.02 : TextSize is now float .
version 0.03 : Attempt to make text size close to other views text size .
version 0.04 : Added Gravity
version 0.05 : TextSize issue should be solved now . Thanks to NJDude and chuath
 

Attachments

  • tickerview.zip
    16 KB · Views: 155
  • tickerview102.zip
    16 KB · Views: 120
  • tickerview103.zip
    16 KB · Views: 122
  • tickerview004.zip
    16.1 KB · Views: 118
  • tickerview005.zip
    16.2 KB · Views: 160
Last edited:
Top