Android Question TextSizes not automatically adjusted on a newer device (Galaxy Tab S 8.4)

adrianstanescu85

Active Member
Licensed User
Longtime User
Hello

I have an app that I'm developing for a year now and it has a lot of labels, spinners and other views on different activities. This app runs on basically any Android 3.0+ device, no matter the screen size and scale.

So far everything worked fine, the labels are set in the designer and so far for each device that I've tested the labels' textsizes were scaled automatically to the correct values without any intervention (as far as I know this is how this process works for the views that are set inside the designer).

Recently I ran my app on a Samsung Galaxy Note 3 (1920 x 1080 px, scale=3 (480 dpi)), and still everything looks as it should.

Then I ran my app on a Samsung Galaxy Tab S 8.4 (2560 x 1600 px, scale=2 (320 dpi)), and... all labels look small!!!!

The only way I was able to solve the problem on the Tab S 8.4 was to include the following:

B4X:
For Each v As View In Activity.GetAllViewsRecursive
        If v Is Label Then
            Dim vLb As Label
            vLb = v
            vLb.TextSize = Round2(vLb.TextSize * GetDeviceLayoutValues.Scale, 0)
        End If
        If v Is Spinner Then
            Dim vSp As Spinner
            vSp = v
            vSp.TextSize = Round2(vSp.TextSize * GetDeviceLayoutValues.Scale, 0)
        End If
    Next

This set everything back to normal, but ONLY for that Tab S 8.4!

If I keep this, then everything is a lot larger for all the previous devices I've tested!

My guess is that the automatic scaling that normally takes place for the views already set inside a layout does have a limitation, maybe on high resolutions like the Tab S 8.4 has.

If anyone can test or confirm this, I'd gladly be interested in a solution for this!!!

Thank you!
Adrian
 

adrianstanescu85

Active Member
Licensed User
Longtime User
One more issue that I presume is related to the problem above is a mismatch of the window in the designer with the Samsung Tab S 8.4's real resolution.

To be precise, I started a blank project, connected the Samsung Tab S 8.4 (2560 x 1600 px, scale =2, 320 dpi) to the Bridge and started the Designer. I also started the Abstract Designer, and then in its Layout menu checked the Match Connected Device. I was surprised to see that the device's window in Abstract Designer fitted on my screen, since my laptop has a 1980 x 1080 px resolution. The Samsung's screen resolution is obviously higher so I would have expected the window to go off the screen. Just to make sure, I checked the Zoom in the Abstract Designer and it was set to 100%, so no variations there. I added the current layout as a new variant, just to make sure everything is properly set.

If I save the layout and reopen everything, the add a Label and set it full screen (activity full screen, title bar off) then its largest size matches the 2560 x 1600 px resolution, but still... the Abstract Designer's window looks half size both on the horizontal and on the vertical (100% zoom).

https://www.dropbox.com/s/etpbcqsrzimalle/Resolution Problem Screenshot.png?dl=0

I do wonder if this erroneus detection has anything to do with the TextSize issue, which frankly appears half as it should.

Thank you!
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You should not scale the text size based on the device scale. The text size units are already scaled.

I think that the text looks smaller on your device because the resolution and (reported) scale of this device match a 10'' tablet. This means that the the your device will show everything a bit smaller than it should be.

Are you using autoscaleall?
 
Upvote 0

adrianstanescu85

Active Member
Licensed User
Longtime User
Scaling the text size was just a comearound so that actually the text would look fine.

I'm not using autoscaleall at all, I've never used it for any device so far, so even if the devices that run my app had basically an entry-level screen or a top-level screen like the Note 3 does, no problems ever occured, that being either smartphones or tablets.

This situation here not only outputs a very small textsize, but when I do the correction above (I modified that to get in place only on higher than 2000px resolutions), the textsize is EXACTLY as it should be (as related to all other elements that are properly shown).

Also, there is the problem with the abstract designer, so I thought that maybe somewhere these two problems are related, after all it's an error with the same factor of about 2.
 
Upvote 0
Top