Android Question Label with 2 lines and different TextSize [SOLVED]

AHilberink

Active Member
Licensed User
Longtime User
Hi,

I have a string:
B4X:
Dim Naam as String = "Jan Jaap - Hoofdstraat 1 Amsterdam"

I need to put this on a label in 2 lines, so
B4X:
Dim lblNaam as label

lblNaam.Initialize
lblNaam.text = Naam.Replace(" - ",CRLF)

This works fine, but I want the first line Size 18 and the second line Size 12. How can I do this?

I tried something like this:
B4X:
Dim BB As BBCodeView
BB.Initialize("","")
BB.Text=naam'.Replace(" - ",CRLF)
BB.Text="[TextSize=18]"&naam.SubString2(0,naam.IndexOf(" - "))&"[/TextSize]"
BB.Text=BB.Text&CRLF&"[TextSize=11]"&naam.SubString2(naam.IndexOf(" - ")+3,naam.Length)&"[/TextSize]"

But did not succeed.
Can someone help?

Kind regards,
André
 

Brian Dean

Well-Known Member
Licensed User
Longtime User
I have not tried this myself, but have you looked at CSBuilder.RelativeSize?


Edit : I have tried it now :

B4X:
    lblTest.Text = cs.Append("This is large").RelativeSize(0.5).Append(Chr(10) & "and this is small").PopAll
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…