Sub Globals
    Dim scvText As ScrollView
    Dim lblText As Label
   
    Dim txt As String
    Dim StrUtil As StringUtils
End Sub
Sub Activity_Create(FirstTime As Boolean)
    ' There is no layout file
   
    scvText.Initialize(100)        ' initialize the Scrollview
    Activity.AddView(scvText, 0, 0, 100%x, 100%y)    ' add the Scrollview on the Activity
    lblText.Initialize("")        ' initialize the Label for the text, without an EventName
    scvText.Panel.AddView(lblText, 0, 0 ,100%x, 100%y)    ' add the Label on the ScrollView internal Panel
    lblText.Color = Colors.RGB(250, 250, 210)                ' set the Label background color
    lblText.TextColor = Colors.Black                                ' set the Label text color
   
    LoadText                                    ' load the text
    SetText                                        ' set the text
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub LoadText
    txt = File.GetText(File.DirAssets, "text1.txt")    ' load the text file into the string
End Sub
Sub SetText
    Dim ht As Float
   
    lblText.Text = txt                    ' set the text string to the Label text property
    ht =     StrUtil.MeasureMultilineTextHeight(lblText, txt)    ' measure Label height
    scvText.Panel.Height = ht        ' set the ScrollView internal Panel height to the measured height
    lblText.Height = ht                    ' set the Label height to the measured height
    scvText.ScrollPosition = 0    ' set the scroll position to the top of the text
    DoEvents                                        ' needed to execute the previous line
End Sub