How to view preview of text size of user font in Android Studio?-ThrowExceptions

Exception or error:

When specifying text size on Android, the suggested the best practice is to use sp font units instead of dp, since with sp the text will increase/decrease in size according to the user’s display preferences. For example, on my device I can go to

Settings -> Display -> Font

and choose a preference: small, normal, large, huge (these seem to vary across devices though).

Does anyone know a way to preview the effect of this preference in Android Studio’s layout preview? It would be easier than having to deploy to a device/emulator in order to test. I can’t see an option for this, but maybe I’m missing it.

Related: is there a standard multiplier for what the largest (“huge”) font preference equals to? Or, can this even vary across devices? If there’s no upper bound to how large the text could be, the first part of my question is probably moot.

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *