Android Question how to change part of a label in color?

Lego Jérôme

Member
Licensed User
hi,

I am bad in English so I use a translator to post on the forum.
To explain my problem I made you an image in attachment.
I know how to change the color of a label.text but I wish I could change the color of a label only on a part of it.

jerome
 

Attachments

  • Sans titre.png
    Sans titre.png
    250.6 KB · Views: 227

Mahares

Expert
Licensed User
Longtime User
I wish I could change the color of a label only on a part of it.

Use CSBuilder like this (voici un example):
B4X:
Dim cs As CSBuilder
    Dim strvar As String ="PPPFFPPFPFFPPP"
    cs.initialize.Color(Colors.Red).Append(strvar.SubString2(0, 5)).Color(Colors.Blue).Append(strvar.SubString2(5, 8)) _
    .Color(Colors.Green).Append(strvar.SubString(8)).PopAll
    lbl.Text=cs  'part of it will be red, the middle blue, the rest green
Bonne Chance
 
Upvote 0
Top