Public Sub InsertAtTextItem(Index As Int, Text As String, Value As Object)
Dim pnl As Panel
pnl.Initialize("")
Dim lbl As Label
lbl.Initialize("")
lbl.TextAlignment = lbl.ALIGNMENT_LEFT
pnl.AddView(lbl, 5dip, 2dip, sv.Width - 5dip, 20dip)
lbl.Text = Text
lbl.Multiline = True
lbl.Font = DefaultTextFont
lbl.TextColor = DefaultTextColor
pnl.Color = DefaultTextBackgroundColor
lbl.SizeToFit
lbl.Height = Max(50dip, lbl.Height)
InsertAt(Index, pnl, lbl.Height + 2dip, Value)
End Sub
I know but i add label in designer and use your code but not apply on labelThis is the code used by CustomListView to set the label's height:
B4X:Public Sub InsertAtTextItem(Index As Int, Text As String, Value As Object) Dim pnl As Panel pnl.Initialize("") Dim lbl As Label lbl.Initialize("") lbl.TextAlignment = lbl.ALIGNMENT_LEFT pnl.AddView(lbl, 5dip, 2dip, sv.Width - 5dip, 20dip) lbl.Text = Text lbl.Multiline = True lbl.Font = DefaultTextFont lbl.TextColor = DefaultTextColor pnl.Color = DefaultTextBackgroundColor lbl.SizeToFit lbl.Height = Max(50dip, lbl.Height) InsertAt(Index, pnl, lbl.Height + 2dip, Value) End Sub
lblbody.Text = re
lblbody.SizeToFit
sv1.Panel.Height = lblbody.Height + sv1.Panel.Height
Because i want to show a simple layout contain 3 label that don't need to CLVWhy not use CustomListView for your layout?