Android Question Change color of two letters

bixmatech

Member
Licensed User
Hello ...

Can I change the color of two letters from sentence?

Like "Hi Mr...." , the main color is Black , I want to change just "Hi" to Red


B4X:
    Dim title As String = "Hi Mr...."
    Dim des As String
    ListView1.AddTwoLines( title , des )

Thank you
 

DonManfred

Expert
Licensed User
Longtime User
use CSBuilder
 
Upvote 0

ronell

Well-Known Member
Licensed User
Longtime User
you can also use richstring lib
B4X:
Sub Globals

    Dim rs As RichString
    Private Label1 As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)

    Activity.LoadLayout("main")
 
    Dim title As String ="HI Mr"
    rs.Initialize(title)
    rs.Color(Colors.Red,0,2)
 
    Label1.Text = rs
 
 
 
End Sub
sample.png
 
Upvote 0
Top