'Adds a text item. The item height will be adjusted based on the text.
Public Sub AddTextItem(Text As String, Value As Object, BackgroundColor As Int)
InsertAtTextItem(items.Size, Text, Value, BackgroundColor)
End Sub
'Inserts a text item at the specified index.
Public Sub InsertAtTextItem(Index As Int, Text As String, Value As Object, BackgroundColor As Int)
Dim pnl As Panel
pnl.Initialize("")
Dim lbl As Label
lbl.Initialize("")
lbl.Gravity = Bit.Or(Gravity.CENTER_VERTICAL, Gravity.LEFT)
pnl.AddView(lbl, 5dip, 2dip, sv.Width - 5dip, 20dip)
lbl.Text = Text
lbl.TextSize = DefaultTextSize
lbl.TextColor = DefaultTextColor
' If DefaultTextBackground <> Null Then
'pnl.Background = DefaultTextBackground
'Else
pnl.Color = BackgroundColor
'End If
Dim minHeight As Int
minHeight = su.MeasureMultilineTextHeight(lbl, Text)
lbl.Height = Max(50dip, minHeight)
InsertAt(Index, pnl, lbl.Height + 2dip, Value)
End Sub