How can I avoid font override by system? For examp...
# android
s
How can I avoid font override by system? For example: if a user set a custom font through settings, I don’t want my app to use that custom font but instead use sans-serif. I tried adding fontFamily to styles.xml but it didn’t help.
google 5
stackoverflow 6
s
You can set the font in xml for each view
s
@Shankar thanks for the answer. The app is quite big now with lots of screen. Is there any easier way of doing this?
s
No, you have to set it for each view by setting font in xml or if there are custom views then you can programmatically
c
don’t set it everywhere, use an app theme: https://stackoverflow.com/a/16407123
s
@Cyril Find This I know, but he wants to set custom font and the style will not work here.
s
I want to use built-in font. Sans-serif is built in font if I am not wrong.
m
‘No, you have to set it for each view by setting font in xml or if there are custom views then you can programmatically’ -> thats the most stupid answer iv ever heard
s
@Sagar Suri Then you can do using font-family attribute.
👍 1