Reputation: 233
in my app there are a lot of strings, I used sp
for the size.
Yesterday I increased the fonts size in the system-preferences of android and now the size is bigger even in my app, but this is not good for me because some strings in my app are already big.
There is a solution to force the font size regardless of operating system?
Thanks a lot
Upvotes: 1
Views: 2639
Reputation: 27748
I am not sure why you would want the app to ignore the system setting. That feature is for people who have difficulty reading small text sizes.
And I have not once come across a solution that lets an app override that feature. If you absolutely must try and override the same anyway, I think (see note at the end) changing the current sp
values to dp
should in, theory, ignore the settings. (some changes. see the update)
The sp
is used specifically for font size (android:textSize
) so that it will also honor the settings the user might override for the entire system. As a developer, you should account for that situation by making sure your layouts account for and accommodate such a change.
If you choose to still ignore it in your app... to each his own.
Note: I place the emphasis is on I think because as a developer who wants his app to be liked and appreciated, I wouldn't consider such an override and hence never ventured to test if it works. Please leave a comment if my theory has been tested by anyone and is to the contrary to mine. ;-)
UPDATE: The theory works. ;-)
I set the System Font Size to Huge before testing this.
Notice that the font in the background remains unchanged. What changes is the font size in the AlertDialog
.
First test after changing the size using the same sp
setting in the app
Second test keeping the same size (huge) but changing the sp
to dp
Upvotes: 8