Sub ShowTags
If Tags.Size = 0 Then Return
Dim bg As ColorDrawable
bg.Initialize(Colors.RGB(Rnd(1,255),Rnd(1,255),Rnd(1,255)),20)
Dim lbl As Label
lbl.Initialize("")
lbl.TextAlignment = lbl.ALIGNMENT_CENTER
lbl.TextColor = Colors.Black
lbl.Text = "Information"
lbl.Color = Colors.RGB(243,243,243)
lbl.Font = Library.GetFont(16)
pnltags.AddView(lbl,0,0,pnltags.Width,50dip)
Top = 50dip
Dim lbdivider As Label
lbdivider.Initialize("")
lbdivider.Color = Colors.ARGB(100,240, 240, 240)
pnltags.AddView(lbdivider,10dip,Top,pnltags.Width-20dip,1dip)
Top = Top + 10dip
For i = 0 To Tags.Size - 1
Dim data As Map
data = Tags.Get(i)
Dim lbl2 As Label
lbl2.Initialize("")
lbl2.TextAlignment = lbl.ALIGNMENT_RIGHT
lbl2.TextColor = Colors.Black
lbl2.Text = (i + 1) & ": " & data.Get("sValue")
lbl2.Font = Library.GetFont(16)
pnltags.AddView(lbl2,10dip,Top,pnltags.Width-20dip,30dip)
Top = Top + 30dip
Dim values(),val As String
val = data.Get("sTagValue")
If val.IndexOf(",") > -1 Then
values = Regex.Split(",",val)
Dim cd As ColorDrawable
cd.Initialize(Colors.RGB(238, 238, 238),9dip)
For j = 0 To values.Length - 1
Dim title As String
title = values(j)
Dim rb As Switch
rb.Initialize("switch")
pnltags.AddView(rb,100%x-70dip,Top,50dip,30dip)
rb.Tag = Array(data.Get("sTitle"),values(j))
Switchs.Add(rb)
Dim lbl4 As Label
lbl4.Initialize("aa")
lbl4.TextAlignment = lbl4.ALIGNMENT_RIGHT
lbl4.TextColor = Colors.Black
lbl4.Text = title
lbl4.Font = Library.GetFont(13)
pnltags.AddView(lbl4,0,Top,100%x-80dip,30dip)
rb.BringToFront
Top = Top + lbl4.Height + 8dip
Next
Top = Top + 40dip
Dim lbdivider As Label
lbdivider.Initialize("")
lbdivider.Color = Colors.ARGB(100,240, 240, 240)
pnltags.AddView(lbdivider,5dip,Top,pnltags.Width - 10dip,1dip)
Top = Top + 10dip
Else
lbl2.Text = lbl2.Text
Dim lblvalue As Label
lblvalue.Initialize("")
lblvalue.TextColor = Colors.Black
lblvalue.TextAlignment = lbl4.ALIGNMENT_CENTER
lblvalue.Font = Library.GetFont(15)
lblvalue.Text = val
pnltags.AddView(lblvalue,10dip,lbl2.Top,70dip,30dip)
Dim lbdivider As Label
lbdivider.Initialize("")
lbdivider.Color = Colors.ARGB(100,240, 240, 240)
pnltags.AddView(lbdivider,10dip,lbl2.Top + 38dip,pnltags.Width-20dip,1dip)
Dim canvas As Canvas
canvas.Initialize(lblvalue)
lblvalue.Width = Page1.RootPanel.Width
Dim cd As ColorDrawable
cd.Initialize(Colors.RGB(219,219,219),lblvalue.Width/3.2)
cd.Apply(lblvalue)
Top = Top + 20dip
End If
Next
pnltags.Height = Top
sv1.ContentHeight = sv1.ContentHeight + pnltags.Height
btnadd2cart.Top = pnltags.Height + pnltags.Top
End Sub