Hi, I'm trying to make a simple application. From the first activity, when I press a button I want to open another Activity in which I load a layout built in the designer. This layout contains a ScrollView between 2 ImageView. I use this code:
First question is why if ScrollView is created in designer, IDE suggests to initialize it? (first [*] sign)
And second problem: Using the above code when opening activity, the application crashed with a black screen. If I remove the code starting with the second [**] mark, the application is no longer blocked, obviously ScrollView being empty.
What I'm doing wrong? Thank you!
B4X:
Sub Globals
Dim sw As ScrollView
Dim lblInformation As Label
Dim su As StringUtils
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("HowTo")
Scale.SetReferenceLayout(480, 800, 1.5)
Scale.ScaleAll(Activity, True)
sw.Initialize(Activity.Height - 300dip) [*]
lblInformation.Initialize("")
sw.Panel.AddView(lblInformation, 10dip, 10dip, sw.Width - 20dip, 100dip) [**]
lblInformation.Color = Colors.White
lblInformation.TextColor = Colors.Black
lblInformation.Text = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim..."
lblInformation.Height = su.MeasureMultilineTextHeight(lblInformation, lblInformation.Text)
sw.Panel.Height = lblInformation.Top + lblInformation.Height + 10dip
End Sub
First question is why if ScrollView is created in designer, IDE suggests to initialize it? (first [*] sign)
And second problem: Using the above code when opening activity, the application crashed with a black screen. If I remove the code starting with the second [**] mark, the application is no longer blocked, obviously ScrollView being empty.
What I'm doing wrong? Thank you!