Hi all,
I'm trying to automatic scale textsizes in every elements I have in my layout but without success
I have good result using the following script, found here in the forum:
It works with most common phone's densities, properly adapted, but I still don't like results with some devices with "abnormal" densities,
I would like to create a sub that proportionally adapts text sizes for all smartphones.
Do you think it would be possible?
Could anybody suggest me another good solution?
Thanks!
Davide
( I hope my english is not too bad! )
I'm trying to automatic scale textsizes in every elements I have in my layout but without success
I have good result using the following script, found here in the forum:
B4X:
Dim lv As LayoutValues
lv = GetDeviceLayoutValues
Select lv.Scale
Case 2
devicetype = "Smartphone 5"
TextSizeRatio = 1.5
Case 1.5
If lv.Width > 1100 Then
devicetype = "Tablet 7"
TextSizeRatio = 2
Else
devicetype = "Smartphone 3.5"
TextSizeRatio = 1
End If
Case 1
If lv.Width > 1100 Then
devicetype = "Tablet 10"
TextSizeRatio = 3
Else If lv.Width < 600 Then
devicetype = "Smartphone 3.5"
TextSizeRatio=1
Else
devicetype = "Tablet 7"
TextSizeRatio = 2
End If
End Select
'then TextSizeRatio to my elements, example:
button1.textsize=14*TestSizeRatio
It works with most common phone's densities, properly adapted, but I still don't like results with some devices with "abnormal" densities,
I would like to create a sub that proportionally adapts text sizes for all smartphones.
Do you think it would be possible?
Could anybody suggest me another good solution?
Thanks!
Davide
( I hope my english is not too bad! )