Private p As B4XView = CreateSizingItem(clv.AsView.Width,txt)
clv.Add(p,act)
private Sub CreateSizingItem(wid As Int, txt as string) As B4XView
Private p As B4XView = xui.CreatePanel("")
' The height in Addview is unimportant as it will automatically resize
Root.AddView(p,0,0,wid,300dip)
'Contains a single item Private RTCS As ResizingTextComponent
p.LoadLayout("ResizingTextComponentSingle")
p.RemoveViewFromParent
' Set up some other stuff
RTCS.SetPadding(20dip,10dip,20dip,10dip)
RTCS.SetBackColor(Globals.gcol_midcol)
RTCS.SetCorners(10dip)
' CSBuilder code removed for clarity
RTCS.Text = txt
' Resize the containing panel
p.Height = RTCS.GetHeight
Return p
End Sub