Android Question TextSize

pere

New Member
Licensed User
Longtime User
Dear all,
I have a beautiful B4A App but I have this issue:

Please see attached picture showing three parcial-screen-shots corresponding to three different devices with different manufacturer and resolution.

The issue: Text Scale not working on SONY XPERIA Z

In order to try to understand the situation I'm using object position and size by program, like this:

Dim LOCAL as Label
Rx=GetDeviceLayoutValues.Height/1280
Ry=GetDeviceLayoutValues.width/800
'Object position working fine:
LOCAL.Top= 3 * Ry
LOCAL.Height = 60 * Ry
LOCAL.Width =236 * Rx
LOCAL.Left =13 * Rx

'and finally the TextSize that FAILS on SONY Xperia Z
LOCAL.TextSize = 24*Ry

I do not understand why LOCAL.TextSize propriety is not working on SONY XPERIA Z and the Label textsize is not changing the size of the label text!!!

I'm appreciating your comments on it!
 

Attachments

  • Differences_SONY_SAMSUNG.png
    Differences_SONY_SAMSUNG.png
    144.2 KB · Views: 409

sorex

Expert
Licensed User
Longtime User
did you try with the dip settings? like ...

B4X:
LOCAL.TextSize = 24dip*Ry
 
Upvote 0

pere

New Member
Licensed User
Longtime User
Don't use dip values for TextSize !

Try this:
B4X:
LOCAL.TextSize = 24 * Ry / GetDeviceLayoutValues.Scale
Or use:
B4X:
Rt = Ry / GetDeviceLayoutValues.Scale
'
'
LOCAL.TextSize = 24 * Rt

It works great now, Klaus!!!.

Now, Font size on Samsung and on SONY XPERIA have exactly the same look. Well, it looks smaller but I know how to fix it ;)

Thank you very much.

PD: Also thanks to all people tried to help me!
 
Upvote 0
Top