Hi
I am try to use Customlistview with CustomLayoutDialog
but I can not get the list to customlistview
I am try to use Customlistview with CustomLayoutDialog
but I can not get the list to customlistview
B4X:
Sub addr_Click
Dim dialog2 As CustomLayoutDialog
Dim sf As Object = dialog2.ShowAsync("Find", "", "", "", Null, False)
dialog2.GetButton(DialogResponse.POSITIVE).TextColor = Colors.Black
dialog2.GetButton(DialogResponse.POSITIVE).TextSize = 20
dialog2.GetButton(DialogResponse.CANCEL).TextColor = Colors.Black
dialog2.GetButton(DialogResponse.CANCEL).TextSize = 20
dialog2.SetSize(40%x, 70%y)
'Code to change top position
Dim jo As JavaObject = sf
Dim window As JavaObject = jo.RunMethodJO("getWindow", Null)
Dim lp As JavaObject = window.RunMethod("getAttributes", Null)
lp.SetField("gravity", Bit.Or(Gravity.TOP, Gravity.CENTER_HORIZONTAL))
lp.SetField("y", 20dip) 'set the top position
window.RunMethod("setAttributes", Array(lp))
Wait For Dialog_Ready (DialogPanel As Panel)
DialogPanel.LoadLayout("address")
For i = 1 To 20
Dim Streetname As String = "name"
Cust_listv.Add(CreateListItem(Streetname,Cust_listv.AsView.Width),52dip)
Next
End Sub
Sub CreateListItem(Text As String, Width As Int) As Panel
Dim p As Panel
p.Initialize("")
p.Color = Colors.White
Dim lbl As Label
lbl.Initialize("")
lbl.Gravity = Bit.Or(Gravity.CENTER_VERTICAL, Gravity.LEFT)
lbl.Text = Text
lbl.TextColor = Colors.Black
lbl.TextSize = 16
p.AddView(lbl,55dip,5dip, Width, 36dip) 'view #1
Return p
End Sub