user1608385
user1608385

Reputation: 649

Preventing user changes to font

I have text animation in my app that is dependent on the font style, size and typeface. The animation does not work properly if the user changes the font through the device settings. Is there a way to prevent the user from changing font size, typeface and style in the xml layout or must I apply a typeface and set style and size in code? Will the latter guarantee protection from user font changes?

Upvotes: 2

Views: 2221

Answers (2)

user1608385
user1608385

Reputation: 649

Well, after trying various combinations of xml parameter settings for the TextView I concluded that the only way to guard the font family from user changes is to set a Typeface on the TextView in code. Setting TextView textSize in xml to DP instead of SP does safeguard the font size.

Upvotes: 2

Display Name is missing
Display Name is missing

Reputation: 6227

Try setting your font sizes in "dp" instead of "sp". SP units will use the user's font size preferences, while dp units only will always use the device's pixel density.

Be careful when doing this though, if everything is set using dp there is a chance that some users will find your app/animation impossible to read.

Upvotes: 0

Related Questions