Android Question ListView AddTwoLinesAndBitmap Ciolor Selection

Schakalaka

Active Member
Licensed User
Hello.
i need set different color in the second line of listview by a string value thant i read.
i have try with IF circle, and select case.

The code work correct only in i stop the code with break.

the code that i use is:

B4X:
                    Dim colorestringa As String = stringArray(6)
                    Select True
                        Case colorestringa = "2"
                            Log("Il Valore era 2")
                            ListView1.TwoLinesAndBitmap.SecondLabel.TextColor = Colors.Cyan
                            ListView1.AddTwoLinesAndBitmap2(lvd.FirstRow,lvd.SeconRow,lvd.Picture,lvd)
                        Case colorestringa = "0"
                            Log("Il Valore era 0")
                            ListView1.TwoLinesAndBitmap.SecondLabel.TextColor = Colors.Yellow
                            ListView1.AddTwoLinesAndBitmap2(lvd.FirstRow,lvd.SeconRow,lvd.Picture,lvd)
                        Case colorestringa = "1"
                            Log("Il Valore era 1")
                            ListView1.TwoLinesAndBitmap.SecondLabel.TextColor = Colors.Green
                            ListView1.AddTwoLinesAndBitmap2(lvd.FirstRow,lvd.SeconRow,lvd.Picture,lvd)
                           
                    End Select
B4X:
if stringArray(6) = "0" then
ListView1.TwoLinesAndBitmap.SecondLabel.TextColor = Colors.Green
else if stringArray(6) = "1" then 
ListView1.TwoLinesAndBitmap.SecondLabel.TextColor = Colors.yellow 
else 
ListView1.TwoLinesAndBitmap.SecondLabel.TextColor = Colors.Cyan

end if
the result shoud be as the attached image, but it work only with "break" active.

Thanks you
 

Attachments

Schakalaka

Active Member
Licensed User
i think that CSBuilder don' t support
ListView1.TwoLinesAndBitmap.SecondLabel.

so i have take a look to xCustomListView, but it is very different to include.

i have create a layout with imageview and 2 labels.
i need a specific example for my situation..
thanks
 

Schakalaka

Active Member
Licensed User
Something like this?

B4X:
ListView1.AddTwoLinesAndBitmap2(cs.Initialize.Color(Colors.White).Append(lvd.FirstRow),cs.Initialize.Color(Colors.yellow).Append(lvd.SeconRow),lvd.Picture,lvd)
it should work in IF circle?
 

Schakalaka

Active Member
Licensed User
THANK YOU!!
IT WORKS!!!!

the correct code is:
B4X:
ListView1.AddTwoLinesAndBitmap2(cs.Initialize.Color(Colors.White).Append(lvd.FirstRow),cs.Initialize.Color(colorestringa).Append(lvd.SeconRow).PopAll,lvd.Picture,lvd)
 
Top