Android Question Listview label color problem

Marc De Loose

Member
Licensed User
Longtime User
The code below does not produce as expected.
It should show back in YELLOW and the rest in RED
But I get
(WHITE) BACK
(WHITE) ""
(WHITE) INCAR
(WHITE) TRACKSURFACE
(RED) ONPITROAD
(RED) AIRTEMP
:
:
then some randow white and some red

I have no idea where I am wrong.


B4X:
Sub setMenuDataListMenu
    MenuListView1Previous = MenuListView1Shown
    MenuListView1Shown = MenuDataList
   
    MenuTittle.Text     = "Data List"
    MenuTittle.TextColor= Colors.White
    MenuTittle.Typeface = DumyLabel.Typeface
    MenuTittle.TextSize = MenuTitleSize
   
    MenuListView1.SingleLineLayout.Label.Typeface=DumyLabel.Typeface
    MenuListView1.SingleLineLayout.Label.TextSize=25
    MenuListView1.SingleLineLayout.ItemHeight=40
   
    MenuListView1.Clear
    MenuListView1.SingleLineLayout.Label.TextColor=Colors.Yellow
    MenuListView1.AddSingleLine2("Back",clickedBack)
    MenuListView1.AddSingleLine("")
   
    MenuListView1.SingleLineLayout.Label.TextColor=Colors.Red
    Dim i As Int=1
    Do While Main.FastDataHash(i).ID > 0
        Dim theId As Int = Main.FastDataHash(i).ID
        If Main.Datas(theId).USED = True Then
            MenuListView1.AddSingleLine2(Main.Datas(theId).NAME,Main.Datas(theId).NAME)
        End If
        i=i+1
    Loop
   
End Sub
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
It does not work with a listview to define different colors for the same types of items.

Solution:
1. Use a xcustomlistview (here you have full control)
2. or use Charsequencebuilder to set the colors to the same type of items.
 
Last edited:
Upvote 0
Top