Android Question How to make ListView1 texts in random color?

IamTrying

Active Member
Licensed User
How to make ListView1 texts in random color? Following code apply color to all the rows.
I wanted to have each row specific color.

B4X:
Sub addList
   
    If myService.rowstatus = "orange" Then
        ListView1.AddSingleLine(myService.html)
        Dim Label1 As Label
        Label1 = ListView1.SingleLineLayout.Label
        Label1.TextSize = 20
        Label1.TextColor = Colors.Yellow
       
       
    else if myService.rowstatus = "red" Then
        ListView1.AddSingleLine(myService.html)
        Dim Label2 As Label
        Label2 = ListView1.SingleLineLayout.Label
        Label2.TextSize = 20
        Label2.TextColor = Colors.red
    Else 
        ListView1.AddSingleLine(myService.html)
        Dim Label3 As Label
        Label3 = ListView1.SingleLineLayout.Label
        Label3.TextSize = 20
        Label3.TextColor = Colors.white
    End If
   
End Sub
 

udg

Expert
Licensed User
Longtime User
In order to have full controll on your items, you should switch to a CustomListView.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…