Mattia
Mattia

Reputation: 1117

Prevent font size and zoom to the screen in my app

Through the device settings, you can change the font size of the text and / or apply a zoom to the screen.

Is there a possibility to prevent this change? I would like my application to always and only keep the dimensions that are specified in my project.

All my layout are composed from ConstraintLayout and all the textSize are in "sp".

Upvotes: 2

Views: 488

Answers (1)

Adrian K
Adrian K

Reputation: 4843

Since sp is just dp multiplied with the system's font scale factor, your behavior can be achieved by declaring all your text sizes in dp. You can use the same numeric values, as the default scale factor is 1.

However, this should only be used in very specific scenarios, otherwise you might reduce usability for users with visual impairments. This is why you will get warnings in your layouts when using dp for text sizes.

Upvotes: 2

Related Questions