Android Question How to create custom Listview with color

Da He

Member
Licensed User
Please!
How to create custom list with color?
 

Attachments

  • 03VPP.jpg
    03VPP.jpg
    10.1 KB · Views: 148

Erel

B4X founder
Staff member
Licensed User
Longtime User
Complete code:
B4X:
Sub Globals
   Private CustomListView1 As CustomListView
   Private xui As XUI
End Sub

Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("1")
   For i = 1 To 100
       Dim p As B4XView = xui.CreatePanel("")
       p.SetLayoutAnimated(0, 0, 0, CustomListView1.AsView.Width, 50dip)
       p.Color = Rnd(0xff000000, -1)
       CustomListView1.Add(p, "")
   Next
End Sub
 
Upvote 0

Da He

Member
Licensed User
Complete code:
B4X:
Sub Globals
   Private CustomListView1 As CustomListView
   Private xui As XUI
End Sub

Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("1")
   For i = 1 To 100
       Dim p As B4XView = xui.CreatePanel("")
       p.SetLayoutAnimated(0, 0, 0, CustomListView1.AsView.Width, 50dip)
       p.Color = Rnd(0xff000000, -1)
       CustomListView1.Add(p, "")
   Next
End Sub
Thank Sir
Very thank!!
 
Upvote 0
Top