Android Question The scrollview not show text

Alisson

Active Member
Licensed User
Hello!

I have a scrollview, but not show the all text.
Justfirst one line is show to user.
I attched a picture of the project.

This my code:


B4X:
#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: False
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

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.

    Private fechar As Button
    Dim sc As ScrollView
    Dim Panel As Panel
    Private Panel2 As Panel
    Private Button1 As Button
    Dim txt As String
    Dim sc As ScrollView
    Dim lblText As Label
    Dim txt As String
    Dim StrUtil As StringUtils
    Dim ht As Float
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")
    txt = File.GetText(File.DirAssets, "file.txt")    ' load the text file into the string
    Activity.LoadLayout("terms")
    sc.Initialize(1000dip)
    Activity.AddView(sc,0%x,13%y,100%x,87%y)
    Button1.RemoveView
    lblText.Initialize("")        ' initialize the Label for the text, without an EventName
    sc.Panel.AddView(lblText, 0, 0 ,100%x, 800%y)    ' add the Label on the ScrollView internal Panel
                                                                                                    ' -2 to automatically adapt the Label height to the text height

    lblText.Color = Colors.RGB(250, 250, 210)                ' set the Label background color
    lblText.TextColor = Colors.Black 
    lblText.Text = txt
    DoEvents                                                    ' force the update of the Label
    ht =     StrUtil.MeasureMultilineTextHeight(lblText, txt)
    sc.Panel.Height = ht     
 
 
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Sub closed_Click
    StartActivity("Loadwelcome")
    Activity.Finish
End Sub

The image SC20160510-094536.png show my result and the image b4a.png like need!

Thanks!
 

Attachments

  • SC20160510-094536.png
    SC20160510-094536.png
    9.1 KB · Views: 205
  • b4a.png
    b4a.png
    10.1 KB · Views: 220
Top