Android Question CS Builder and text sizes wierd behavior

fbritop

Active Member
Licensed User
I have the following code, which with the same text, typeface and size, produces a different result. Why is this?

B4X:
    Dim l As Label   
    l.Initialize("")
    Activity.AddView(l, 0,0,100%x,50dip)
    l.Typeface=Main.fontLight
    l.textsize=16
    l.textcolor=Colors.black
    l.Text="Controlar los accesos desde la comodidad de tu c"
    l.BringToFront
    l.SingleLine=True
    l.Color=Colors.white
    
    
    Dim l As Label
    l.Initialize("")
    Activity.AddView(l, 0,50dip,100%x,50dip)
    cs.Initialize().Typeface(Main.fontLight).Size(16).Color(Colors.black).Append("Controlar los accesos desde la comodidad de tu c").PopAll
    l.text=cs
    l.BringToFront
    l.SingleLine=True
    l.SingleLine=True
    l.Color=Colors.yellow



1593038210251.png
 

Erel

Administrator
Staff member
Licensed User
I've tested it with this code:
B4X:
Sub Activity_Create(FirstTime As Boolean)
    Dim l As Label
    l.Initialize("")
    Activity.AddView(l, 0,0,100%x,50dip)
    l.Typeface = Typeface.DEFAULT
    l.textsize=16
    l.textcolor=Colors.black
    l.Text="Controlar los accesos desde la comodidad de tu c"
    l.BringToFront
    l.SingleLine=True
    l.Color=Colors.white
    
    
    Dim l As Label
    l.Initialize("")
    Activity.AddView(l, 0,50dip,100%x,50dip)
    Dim cs As CSBuilder
    cs.Initialize().Typeface(Typeface.DEFAULT).Size(16).Color(Colors.black).Append("Controlar los accesos desde la comodidad de tu c").PopAll
    l.text=cs
    l.BringToFront
    l.SingleLine=True
    l.Color=Colors.yellow
End Sub
The result is:
B4A_4GmDfiFql7.png


My guess is that you set the font size in your device settings to be larger than standard and apparently it doesn't affect CSBuilder.
 
Upvote 0

Mahares

Expert
Licensed User
My guess is that you set the font size in your device settings to be larger than standard and apparently it doesn't affect CSBuilder.
You absolutely correct. Out of curiosity, I tested the OP code and I spent over an hour moving items around the CSBuilder code to see if it makes a difference, but, to no avail. Until I read your answer. I never thought to look at the Settings font on the device which makes a difference if set at other than the default.
 
Upvote 0

fbritop

Active Member
Licensed User
Yes thats correct @Erel, one of the tipical issues with users is that they set their phones with a huge font, that makes imposible event to put a single button on the App. My App runs two many dynamic views, so I cannot use them with variants as layouts.

I`ve been playing arround with diferent text sizes and display sizes (both from settings), but it changes from phone to phone.

My goal is, for example, if my standard font size is 16 and has certain size on the screen, that font will keep on all devices, no matter what display o text size the user has set up in device settings.

I`ve been playing arround with LayoutValues and Accessiblity but still I cannot get to solve this issue.
 
Upvote 0

fbritop

Active Member
Licensed User
It is a mistake in most cases. If the user wants an increased text size then you should probably respect his/her choice.
Sure for that, but in the case of custom keypads, we cannot support user size.

On the other hand, then it seems to me that CSBuilder does not respect user settings then, because it does not change the label size on screen
 
Upvote 0
Top