Dim p As Label
p.Initialize("")
p.Text = DocText
sv.Panel.AddView(p, 0, 0, sv.Panel.Width, sv.Panel.Height)
Dim a As StringUtils
b = a.MeasureMultilineTextHeight(p,p.Text)
p.Height = b
sv.Panel.Height = b
The inner panel width is set to -1. This is a special value that causes the panel to fill the containing ScrollView.
You should instead use:
B4X:sv.Panel.AddView(p, 0, 0, sv.Width, sv.Height)
lbl_info.RemoveView
scv_info.Panel.AddView(lbl_info, 0, 0 ,100%x, 100%y)
I would suggest you a ScrollView view with a Label.
Attached a small test program that shows the principle.
Best regards.
vp.Initialize("vp", 5, 100%x, height)
Activity.AddView(vp.AsView, 0, 0, 100%x, height)
vp.Panels(3).LoadLayout("3")
bar.Initialize("bar")
bar.AddTab("Help")
sv_help.Initialize(0)
sv_help.Panel.Color=Colors.Black
lb_help.Text = File.GetText(File.DirAssets,"help.txt")
vp.Panels(3).AddView(sv_help,0,90dip,100%x,50%y)
Dim stu As StringUtils
lb_help.Height = stu.MeasureMultilineTextHeight(lb_help, lb_help.Text)
sv_help.Panel.Height = lb_help.Height
You need to set the height of the scrollviews internal panel and the label.
You need the StringUtils library.
Perhaps you need to add a DoEvents after sv_help.Panel.Height = lb_help.HeightB4X:Dim stu As StringUtils lb_help.Height = stu.MeasureMultilineTextHeight(lb_help, lb_help.Text) sv_help.Panel.Height = lb_help.Height
sv_help.Initialize(0)
sv_help.Panel.Color=Colors.Black
vp.Panels(3).AddView(sv_help,0,50dip,100%x,90%y)
lb_help.RemoveView
sv_help.Panel.AddView(lb_help,0,0,100%x,100%y)
lb_help.Text = File.GetText(File.DirAssets,"help.txt")
Dim stu As StringUtils
lb_help.height = stu.MeasureMultilineTextHeight(lb_help, lb_help.Text)
Log(lb_help.height)
sv_help.Panel.height = lb_help.height
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?