I use the panels with a scrollview, but I'm changing to a customlistview.
I use AutoScaleAll in the designer and if I use dip in Add of the customlistview, to a fixed height, I see diffences in the screen in a tablet and in a phone.
Because I don't know what is the height of the panel in different resolutions, I created the sub below to check the name of the panel in the layout and get the size.
So, I set the correct height of the panel used in the customlistview and works fine (in tablet and phone).
In this sub I need to create 2 panels and load the layout 2 times.
Is there a better way to make this?
I use AutoScaleAll in the designer and if I use dip in Add of the customlistview, to a fixed height, I see diffences in the screen in a tablet and in a phone.
Because I don't know what is the height of the panel in different resolutions, I created the sub below to check the name of the panel in the layout and get the size.
So, I set the correct height of the panel used in the customlistview and works fine (in tablet and phone).
In this sub I need to create 2 panels and load the layout 2 times.
Is there a better way to make this?
B4X:
Sub CreateListItem(Lay As String, Width As Int, pnl As Panel) As Panel
Dim p1 As B4XView = xui.CreatePanel("")
p1.LoadLayout(Lay)
p1.Height = pnl.Height
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(0, 0, 0, Width, p1.Height) 'correct height of panel to phone and tablet
p.LoadLayout(Lay)
Return p
End Sub
usage:
clv.Add(CreateListItem("resume", clv.AsView.Width, ResumePanel), 0)
clv.Add(CreateListItem("task", clv.AsView.Width, TaskPanel), 0)